Toolbar::createButtonGroup

@return Group
354616
public function createButtonGroup()
    {
        $node = new Group();
        $this->childNodes->push($node);

        return $this->childNodes->last();
    }
577826
public function getButtons()
	{
		if($this->_buttons===null)
			$this->_buttons=new CFormElementCollection($this,true);
		return $this->_buttons;
	}
688448
protected function createPageButtons()
        {
                if(($pageCount=$this->getPageCount())<=1)
                        return array();

                list($beginPage,$endPage)=$this->getPageRange();
                $currentPage=$this->getCurrentPage(false); // currentPage is calculated in getPageRange()
                $buttons=array();

                // first page
                $buttons[]=$this->createPageButton($this->firstPageLabel,0,self::CSS_FIRST_PAGE,$currentPage<=0,false);

                // prev page
                if(($page=$currentPage-1)<0)
                        $page=0;
                $buttons[]=$this->createPageButton($this->prevPageLabel,$page,self::CSS_PREVIOUS_PAGE,$currentPage<=0,false);

                // internal pages
                for($i=$beginPage;$i<=$endPage;++$i)
                        $buttons[]=$this->createPageButton($i+1,$i,self::CSS_INTERNAL_PAGE,false,$i==$currentPage);

                // next page
                if(($page=$currentPage+1)>=$pageCount-1)
                        $page=$pageCount-1;
                $buttons[]=$this->createPageButton($this->nextPageLabel,$page,self::CSS_NEXT_PAGE,$currentPage>=$pageCount-1,false);

                // last page
                $buttons[]=$this->createPageButton($this->lastPageLabel,$pageCount-1,self::CSS_LAST_PAGE,$currentPage>=$pageCount-1,false);

                return $buttons;
        }
297250
public function actionButtons()
    {
        echo Html::beginTag('div', ['class' => "{$this->id}-nestable-menu"]);

        echo Html::beginTag('div', ['class' => 'btn-group']);
        echo Html::button(Yii::t('voskobovich/nestedsets', 'Add node'), [
            'data-toggle' => 'modal',
            'data-target' => "#{$this->id}-new-node-modal",
            'class' => 'btn btn-success'
        ]);
        echo Html::button(Yii::t('voskobovich/nestedsets', 'Collapse all'), [
            'data-action' => 'collapse-all',
            'class' => 'btn btn-default'
        ]);
        echo Html::button(Yii::t('voskobovich/nestedsets', 'Expand all'), [
            'data-action' => 'expand-all',
            'class' => 'btn btn-default',
            'style' => 'display: none'
        ]);
        echo Html::endTag('div');

        echo Html::endTag('div');
    }
42634
protected function makeSidebar()
    {
        $this->navigation->create(Navigable::MENU_SIDEBAR, function (MenuBuilder $sidebar) {
            $sidebar->header('Main Menu');

            // Dashboard
            $sidebar->route('scaffold.dashboard', trans('administrator::module.dashboard'), [], 1, [
                'id' => 'dashboard',
                'icon' => 'fa fa-dashboard',
                'active' => str_is(request()->route()->getName(), 'scaffold.dashboard'),
            ]);

            // Create new users group
            $sidebar->dropdown(trans('administrator::module.groups.users'), function (MenuItem $sub) {
                $sub->route('scaffold.create', trans('administrator::buttons.create_item', ['resource' => 'User']), ['module' => 'users'], 1, []);
            }, 2, ['id' => 'groups', 'icon' => 'fa fa-group']);
        });
    }
962413
public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) {
		return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons));
	}
295634
protected function bootstrapButtonGroup($class, $role, array $buttons) {

        $attributes = [];

        $attributes["class"] = $class;
        $attributes["role"]  = $role;

        $innerHTML = "\n" . implode("\n", $buttons) . "\n";

        return static::coreHTMLElement("div", $innerHTML, $attributes);
    }
1184209
protected function createComponentPermissionsList(): DataGrid
	{
		$grid = $this->dataGridFactory->create();

		$grid->setDataSource($this->orm->acl->findByRoles($this->viewSuperadmin));

		$deleteUnusedResources = $grid->addToolbarButton('deleteUnusedResources!', 'cms.permissions.deleteUnusedResources');
		$deleteUnusedResources->setClass($deleteUnusedResources->getClass() . ' ajax');
		$clearCacheACL = $grid->addToolbarButton('clearCacheAcl!', 'cms.permissions.clearCacheAcl');
		$clearCacheACL->setClass($clearCacheACL->getClass() . ' ajax');

		$grid->addColumnText('role', 'cms.permissions.role')
			->setRenderer(function (Acl $acl) {
				return $acl->role->title;
			})
			->setEditableInputTypeSelect($this->orm->aclRoles->fetchPairs($this->viewSuperadmin))
			->setEditableCallback([$this, 'setPermissionRole'])
			->setFilterSelect(['' => $this->translate('form.none')] + $this->orm->aclRoles->fetchPairs($this->viewSuperadmin));

		$grid->addColumnText('resource', 'cms.permissions.resource')
			->setRenderer(function (Acl $acl) {
				return $acl->resource->resource . ' - ( ' . $this->translate($acl->resource->name) . ' )';
			})
			->setEditableInputTypeSelect($this->orm->aclResources->fetchPairsByResourceName())
			->setEditableCallback([$this, 'setPermissionResource'])
			->setFilterSelect(['' => $this->translate('form.none')] + $this->orm->aclResources->fetchPairsByResourceName());

		$privilege = $grid->addColumnStatus('privilege', 'cms.permissions.privilege');
		$privilege->setFilterSelect(['' => 'form.none'] + $this->privileges)
			->setTranslateOptions();
		foreach ($this->privileges as $key => $name) {
			$privilege->addOption($key, $name)
				->setClass('btn-default');
		}
		$privilege->onChange[] = [$this, 'setPermissionPrivilege'];

		$state = $grid->addColumnStatus('allowed', 'default.state');
		$state->setFilterSelect(['' => 'form.none'] + $this->access)
			->setTranslateOptions();
		$state->addOption(1, 'cms.permissions.allowed')
			->setClass('btn-success');
		$state->addOption(0, 'cms.permissions.denied')
			->setClass('btn-danger');
		$state->onChange[] = [$this, 'setPermissionState'];

		$grid->addAction('delete', null, 'deletePermission!')
			->setIcon('trash')
			->setTitle('default.delete')
			->setClass('btn btn-xs btn-danger ajax')
			->setConfirm(function (Acl $permission) {
				return $this->translate('cms.permissions.confirmDeletePermission', 1, ['name' => $permission->resource->name]);
			});

		$add = $grid->addInlineAdd()
			->setPositionTop()
			->setTitle('cms.permissions.addPermission');
		$add->onControlAdd[] = [$this, 'permissionForm'];
		$add->onSubmit[] = [$this, 'addPermission'];

		$grid->addGroupAction('default.delete')->onSelect[] = [$this, 'deletePermissions'];

		return $grid;
	}
187767
protected function getPageButtonsArrayText()
    {
        if (empty($this->buttons)) {
            return Builder::getArray(array('' => 0), true);
        }
        $pageButtons = array();
        foreach ($this->buttons as $pageButton) {
            $pageButtons[$pageButton->getControl()
                                    ->getId()] = $pageButton->getPagingCount();
        }
        return Builder::getArray($pageButtons, true);
    }
498805
protected function createDemoGroup()
    {
        $nodePerimeter = $this->createPerimeter(NodeInterface::ENTITY_TYPE, array(
            'root/fixture_page_legal_mentions',
            'root/fixture_page_contact'
        ));
        $nodeProfileCollection = $this->createProfileCollection(array('profile-Contributor'));

        $group = new Group();
        $group->addLabel('en', 'Demo group');
        $group->addLabel('fr', 'Groupe de démo');
        $group->setSite($this->getReference('site2'));
        $group->addWorkflowProfileCollection(NodeInterface::ENTITY_TYPE, $nodeProfileCollection);
        $group->addPerimeter($nodePerimeter);

        return $group;
    }
1314347
public function createSidebarMenu()
    {
        $menu = $this->factory->createItem('root');

        foreach ($this->pool->getAdminGroups() as $name => $group) {
            $extras = [
                'icon' => $group['icon'],
                'label_catalogue' => $group['label_catalogue'],
                'roles' => $group['roles'],
                'sonata_admin' => true,
            ];

            $menuProvider = $group['provider'] ?? 'sonata_group_menu';
            $subMenu = $this->provider->get(
                $menuProvider,
                [
                    'name' => $name,
                    'group' => $group,
                ]
            );

            $subMenu = $menu->addChild($subMenu);
            $subMenu->setExtras(array_merge($subMenu->getExtras(), $extras));
        }

        $event = new ConfigureMenuEvent($this->factory, $menu);
        $this->eventDispatcher->dispatch(ConfigureMenuEvent::SIDEBAR, $event);

        return $event->getMenu();
    }
85122
protected function _createGroup($key, array $gOptions, array $selected, array $options)
    {
        $label  = (is_int($key)) ? sprintf($this->_translate('Select group %s'), $key) : $key;
        $output = array(
            '<optgroup label="' . $this->_translate($label) . '">'
        );
        foreach ($gOptions as $value => $label) {
            if (Arr::key($value, $options)) {
                continue;
            }

            $classes = implode(' ', array(
                $this->_jbSrt('option'),
                $this->_jbSrt('option-' . Str::slug($label)),
            ));

            $isSelected = $this->_isSelected($value, $selected);

            $output[] = $this->_option($value, $isSelected, $classes, $label);
        }

        $output[] = '</optgroup>';

        return implode(PHP_EOL, $output);
    }
1039820
public function addButton(Button $button)
    {
        $this->list[] = $button;
        $this->listCount++;
        $this->ulList = false;
        return $this;
    }
285410
public function addButtons()
    {
        $this->save = $this->addSubmit('Save');
        $this->reset = $this->addSubmit('Reset');

        return $this;
    }
106567
protected function createButton() {
		
		switch ($this->buttonType) {
			case self::BUTTON_LINK:
				return CHtml::link($this->label, $this->url, $this->htmlOptions);

			case self::BUTTON_SUBMIT:
				$this->htmlOptions['type'] = 'submit';
				return CHtml::htmlButton($this->label, $this->htmlOptions);

			case self::BUTTON_RESET:
				$this->htmlOptions['type'] = 'reset';
				return CHtml::htmlButton($this->label, $this->htmlOptions);

			case self::BUTTON_SUBMITLINK:
				return CHtml::linkButton($this->label, $this->htmlOptions);

			case self::BUTTON_AJAXLINK:
				return CHtml::ajaxLink($this->label, $this->url, $this->ajaxOptions, $this->htmlOptions);

			case self::BUTTON_AJAXBUTTON:
				$this->ajaxOptions['url'] = $this->url;
				$this->htmlOptions['ajax'] = $this->ajaxOptions;
				return CHtml::htmlButton($this->label, $this->htmlOptions);

			case self::BUTTON_AJAXSUBMIT:
				$this->ajaxOptions['type'] = isset($this->ajaxOptions['type']) ? $this->ajaxOptions['type'] : 'POST';
				$this->ajaxOptions['url'] = $this->url;
				$this->htmlOptions['type'] = 'submit';
				$this->htmlOptions['ajax'] = $this->ajaxOptions;
				return CHtml::htmlButton($this->label, $this->htmlOptions);

			case self::BUTTON_INPUTBUTTON:
				return CHtml::button($this->label, $this->htmlOptions);

			case self::BUTTON_INPUTSUBMIT:
				$this->htmlOptions['type'] = 'submit';
				return CHtml::button($this->label, $this->htmlOptions);
				
			case self::BUTTON_TOGGLE_RADIO:
				return $this->createToggleButton('radio');
				
			case self::BUTTON_TOGGLE_CHECKBOX:
				return $this->createToggleButton('checkbox');
				
			default:
				return CHtml::htmlButton($this->label, $this->htmlOptions);
		}
	}
430245
protected function createPageButtons()
	{
		if(($pageCount=$this->getPageCount())<=1)
			return array();

		list($beginPage,$endPage)=$this->getPageRange();
		$currentPage=$this->getCurrentPage(false); // currentPage is calculated in getPageRange()
		$buttons=array();

		// first page
		if ($this->firstPageLabel !== false) {
			$buttons[]=$this->createPageButton($this->firstPageLabel,0, $this->firstPageCssClass,$currentPage<=0,false);
		}
		// prev page
		if ($this->prevPageLabel !== false) {
			if(($page=$currentPage-1)<0)
				$page=0;
			$buttons[]=$this->createPageButton($this->prevPageLabel,$page, $this->previousPageCssClass,$currentPage<=0,false);
		}

		// internal pages
		for($i=$beginPage;$i<=$endPage;++$i)
			$buttons[]=$this->createPageButton($i+1,$i, $this->internalPageCssClass,false,$i==$currentPage);

		// next page
		if ($this->nextPageLabel !== false) {
			if(($page=$currentPage+1)>=$pageCount-1)
				$page=$pageCount-1;
			$buttons[]=$this->createPageButton($this->nextPageLabel,$page, $this->nextPageCssClass,$currentPage>=$pageCount-1,false);
		}
		// last page
		if ($this->lastPageLabel !== false) {
			$buttons[]=$this->createPageButton($this->lastPageLabel,$pageCount-1, $this->lastPageCssClass,$currentPage>=$pageCount-1,false);
		}

		return $buttons;
	}
1175793
public function createFormGroup(array $attributes = [])
    {
        $this->childNodes->push(new Group($attributes));

        return $this->childNodes->last();
    }