Add a menu item that is never added to the navigation tree and only shows up as a button.

@param string $label
@param string $privilege
@param string $controller
@param string $action
@param array $other
@return \Gems_Menu_SubMenuItem
543088
public function addButtonOnly($label, $privilege, $controller, $action = 'index', array $other = array())
    {
        $other['button_only'] = true;

        return $this->addPage($label, $privilege, $controller, $action, $other);
    }
960447
public function button(
            $label    = null,
            $url      = null,
            $status   = null,
            $icon     = null,
            $block    = false,
            $disabled = false,
            $flat     = false,
            $size     = Button::SIZE_NORMAL)
    {
        $button = new Button($label, $url, $status, $icon, $block, $disabled, $flat, $size);
        return $this->addButton($button);
    }
1016801
function add_plugin_action_link( $label, $url, $external = false, $priority = WP_FS__DEFAULT_PRIORITY, $key = false ) {
            $this->_logger->entrance();

            if ( ! isset( $this->_action_links[ $priority ] ) ) {
                $this->_action_links[ $priority ] = array();
            }

            if ( false === $key ) {
                $key = preg_replace( "/[^A-Za-z0-9 ]/", '', strtolower( $label ) );
            }

            $this->_action_links[ $priority ][] = array(
                'label'    => $label,
                'href'     => $url,
                'key'      => $key,
                'external' => $external
            );
        }
560845
public function addGroup($name, $label, $priority = 0): ControlCollection
    {
        $this->groups[$name] = compact('label', 'priority');

        return $this;
    }
239768
public function addButton($label = 'Continue')
    {
        if (!is_array($label)) {
            $label = array($label, 'icon-r' => 'right-big');
        }

        /** @type Button $button */
        $button = $this->add('Button', null, 'Button');

        return $button->set($label);
    }
1309962
public function buildResource(?string $controller = null, ?string $action = null):?string
    {
        return $controller !== null ? $controller . ($action !== null ? self::RSEP . $action : '') : null;
    }
1195747
public function accessPossible(User $user, $controller, $action) {
        $isUser = false;
        foreach ($user->getRoles() as $role) {
            if ($role == TaoRoles::BASE_USER) {
                $isUser = true;
                break;
            }
        }
        return $isUser || $this->inWhiteList($controller, $action);
    }
1212012
public function addAnnotationController($bundle, $controller)
    {
        $current = '';

        if (file_exists($this->file)) {
            $current = file_get_contents($this->file);
        } elseif (!is_dir($dir = dirname($this->file))) {
            mkdir($dir, 0777, true);
        }

        $code = sprintf("%s:\n", Container::underscore(substr($bundle, 0, -6)).'_'.Container::underscore($controller));

        if($this->controllerFolder) {
            $controller = $this->controllerFolder . '/' . $controller;
        }
        
        $code .= sprintf("    resource: \"@%s/Controller/%sController.php\"\n    type:     annotation\n", $bundle, $controller);

        $code .= "\n";
        $code .= $current;

        return false !== file_put_contents($this->file, $code);
    }
258730
protected function _addUsedPrivileges(array &$privileges, $label)
    {
        foreach ($this->_subItems as $item) {
            // Skip autofilter action, but include all others
            if ($item->get('action') == 'autofilter') {
                continue;
            }
            $_itemlabel = $label . ($item->get('label') ?: $item->get('privilege'));
            if ($_privilege = $item->get('privilege')) {

                if (isset($privileges[$_privilege])) {
                    $privileges[$_privilege] .= "<br/>&nbsp; + " . $_itemlabel;
                } else {
                    $privileges[$_privilege] = $_itemlabel;
                }
            }
            $item->_addUsedPrivileges($privileges, $_itemlabel . '-&gt;');
        }
    }
241936
public Button addMenuEntry(String label, Resource icon) {

        Button button = new Button(label, icon);
        button.setPrimaryStyleName(OpenCmsTheme.VERTICAL_MENU_ITEM);
        addComponent(button);
        return button;
    }
755607
public function addQuestion(string $label, string $placeholder = ''): Menu
    {
        $itemCallable = function (CliMenu $menu) use ($label, $placeholder) {
            $result = $menu->askText()
                ->setPromptText($label)
                ->setPlaceholderText($placeholder)
                ->ask();

            $this->result = $result->fetch();

            $menu->close();
        };

        $this->addItem($label, $itemCallable);

        return $this;
    }
168059
public function invokeAction($controller, $action, $params)
    {
        $actionMethod = $action . 'Action';

        if (!method_exists($controller, $actionMethod)) {
            throw new NotFoundActionException([
                '`:controller:::action` method does not exist',
                'action' => $actionMethod,
                'controller' => get_class($controller)
            ]);
        }

        $this->eventsManager->fireEvent('request:authorize', $this);

        $this->eventsManager->fireEvent('request:validate', $this, ['controller' => get_class($controller), 'action' => $action]);

        $this->eventsManager->fireEvent('request:ready', $this);

        $this->eventsManager->fireEvent('request:invoke', $this, $action);

        $args = $this->_buildActionArgs($controller, $action, $params);

        switch (count($args)) {
            case 0:
                $r = $controller->$actionMethod();
                break;
            case 1:
                $r = $controller->$actionMethod($args[0]);
                break;
            case 2:
                $r = $controller->$actionMethod($args[0], $args[1]);
                break;
            case 3:
                $r = $controller->$actionMethod($args[0], $args[1], $args[2]);
                break;
            default:
                $r = call_user_func_array([$controller, $actionMethod], $args);
                break;
        }

        $this->eventsManager->fireEvent('request:invoked', $this, ['action' => $action, 'return' => $r]);

        return $r;
    }
1275015
public function addTrackBuilderMenu($label, array $other = array())
    {
        $setup = $this->addContainer($label);

        // SURVEY SOURCES CONTROLLER
        $page = $setup->addPage($this->_('Survey Sources'), 'pr.source', 'source');
        $page->addAutofilterAction();
        $page->addCreateAction();
        $page->addExportAction();
        $page->addImportAction();
        $show = $page->addShowAction();
        $show->addEditAction();
        $show->addDeleteAction();

        $show->addAction($this->_('Check status'), null, 'ping')
                ->addParameters(\MUtil_Model::REQUEST_ID);
        $show->addAction($this->_('Synchronize surveys'), 'pr.source.synchronize', 'synchronize')
                ->addParameters(\MUtil_Model::REQUEST_ID);
        $show->addAction($this->_('Check is answered'), 'pr.source.check-answers', 'check')
                ->addParameters(\MUtil_Model::REQUEST_ID);
        $show->addAction($this->_('Check attributes'), 'pr.source.check-attributes', 'attributes')
                ->addParameters(\MUtil_Model::REQUEST_ID);

        $page->addAction($this->_('Synchronize all surveys'), 'pr.source.synchronize-all', 'synchronize-all');
        $page->addAction($this->_('Check all is answered'), 'pr.source.check-answers-all', 'check-all');
        $page->addAction($this->_('Check all attributes'), 'pr.source.check-attributes-all', 'attributes-all');

        // ADD CHART SETUP CONTROLLER
        $setup->addBrowsePage($this->_('Charts setup'), 'pr.chartsetup', 'chartconfig');

        // ADD CONDITIONS CONTROLLER - do not include import/export as this is handled by track import/export
        $conditions = $setup->addPage($this->_('Conditions'), 'pr.conditions', 'condition');
        $conditions->addAutofilterAction();
        $conditions->addCreateAction();
        $show = $conditions->addShowAction();
        $show->addEditAction();
        $show->addDeleteAction();

        // SURVEY MAINTENANCE CONTROLLER
        $page = $setup->addPage($this->_('Surveys'), 'pr.survey-maintenance', 'survey-maintenance');
        $page->addAutofilterAction();
        $page->addExportAction();
        $showPage = $page->addShowAction();
        $showPage->addEditAction();
        $showPage->addAction($this->_('Check is answered'), 'pr.survey-maintenance.check', 'check')
                ->addParameters(\MUtil_Model::REQUEST_ID)
                ->setParameterFilter('gsu_active', 1);
        $showPage->addAction($this->_('Import answers'), 'pr.survey-maintenance.answer-import', 'answer-import')
                ->addParameters(\MUtil_Model::REQUEST_ID)
                ->setParameterFilter('gsu_active', 1);
        $showPage->addPdfButton($this->_('PDF'), 'pr.survey-maintenance')
                ->addParameters(\MUtil_Model::REQUEST_ID)
                ->setParameterFilter('gsu_has_pdf', 1);
        // Multi survey
        $page->addAction($this->_('Check all is answered'), 'pr.survey-maintenance.check-all', 'check-all');
        $page->addAction($this->_('Import answers'), 'pr.survey-maintenance.answer-import', 'answer-imports');

        $page->addPage($this->_('Update to new survey'), 'pr.track-maintenance.edit', 'update-survey', 'run');

        // TRACK MAINTENANCE CONTROLLER
        $page = $setup->addPage($this->_('Tracks'), 'pr.track-maintenance', 'track-maintenance', 'index');
        $page->addAutofilterAction();
        $page->addCreateAction();
        //$page->addExportAction();
        $page->addImportAction();
        $showPage = $page->addShowAction();
        $showPage->addEditAction();
        $showPage->addDeleteAction();
        /*$showPage->addButtonOnly($this->_('Copy'),  'pr.track-maintenance.copy', 'track-maintenance', 'copy')
                ->setModelParameters(1);*/

        $showPage->addAction($this->_('Export'), 'pr.track-maintenance.export', 'export')
                 ->addParameters(\MUtil_Model::REQUEST_ID);
        $showPage->addAction($this->_('Check rounds'), 'pr.track-maintenance.check', 'check-track')
                ->addParameters(\MUtil_Model::REQUEST_ID)
                ->setParameterFilter('gtr_active', 1);
        $showPage->addAction($this->_('Recalculate fields'), 'pr.track-maintenance.check', 'recalc-fields')
                ->addParameters(\MUtil_Model::REQUEST_ID)
                ->setParameterFilter('gtr_active', 1);

        // Fields
        $fpage = $showPage->addPage($this->_('Fields'), 'pr.track-maintenance', 'track-fields')
                ->addNamedParameters(\MUtil_Model::REQUEST_ID, 'gtf_id_track');
        $fpage->addAutofilterAction();
        $fpage->addCreateAction('pr.track-maintenance.create')
                ->addNamedParameters(\MUtil_Model::REQUEST_ID, 'gtf_id_track');
        $fpage = $fpage->addShowAction()
                ->addNamedParameters(\MUtil_Model::REQUEST_ID, 'gtf_id_track', \Gems_Model::FIELD_ID, 'gtf_id_field', 'sub', 'sub');
        $fpage->addEditAction('pr.track-maintenance.edit')
                ->addNamedParameters(\Gems_Model::FIELD_ID, 'gtf_id_field', \MUtil_Model::REQUEST_ID, 'gtf_id_track', 'sub', 'sub');
        $fpage->addDeleteAction('pr.track-maintenance.delete')
                ->addNamedParameters(\Gems_Model::FIELD_ID, 'gtf_id_field', \MUtil_Model::REQUEST_ID, 'gtf_id_track', 'sub', 'sub');

        // Rounds
        $rpage = $showPage->addPage($this->_('Rounds'), 'pr.track-maintenance', 'track-rounds')
                ->addNamedParameters(\MUtil_Model::REQUEST_ID, 'gro_id_track');
        $rpage->addAutofilterAction();
        $rpage->addCreateAction('pr.track-maintenance.create')
                ->addNamedParameters(\MUtil_Model::REQUEST_ID, 'gro_id_track');
        $spage = $rpage->addShowAction()
                ->addNamedParameters(\MUtil_Model::REQUEST_ID, 'gro_id_track', \Gems_Model::ROUND_ID, 'gro_id_round');
        $spage->addEditAction('pr.track-maintenance.edit')
                ->addNamedParameters(\Gems_Model::ROUND_ID, 'gro_id_round', \MUtil_Model::REQUEST_ID, 'gro_id_track');
        $spage->addDeleteAction('pr.track-maintenance.delete')
                ->addNamedParameters(\Gems_Model::ROUND_ID, 'gro_id_round', \MUtil_Model::REQUEST_ID, 'gro_id_track');

        $ajaxPage = $this->addPage($this->_('Sort rounds'), 'pr.track-maintenance.edit', 'track-rounds', 'sort', array('visible' => false));

        $overviewPage = $page->addPage($this->_('Tracks per org'), 'pr.track-maintenance.trackperorg', 'track-overview', 'index');
        $overviewPage->addExportAction();
        $overviewPage->addAutofilterAction();

        $page->addAction($this->_('Check all rounds'), 'pr.track-maintenance.check-all', 'check-all');
        $page->addAction($this->_('Recalculate all fields'), 'pr.track-maintenance.check-all', 'recalc-all-fields');

        return $setup;
    }
35036
public function createPlacementNavigation($rootNode, $admin, $controller, $menuItemManager)
    {
        $lastEdited = $this->get('session')->get('MenuItem.last_edited');

        $nodeDecorator = function ($node) use ($admin, $controller, $menuItemManager, $lastEdited) {
            if ($lastEdited == $node['id']) {
                return;
            }
            $node = $menuItemManager->find($node['id']);

            return $controller->renderView(
                '@NetworkingInitCms/MenuItemAdmin/placement_item.html.twig',
                ['admin' => $admin, 'last_edited' => $lastEdited, 'node' => $node]
            );
        };

        $childOpen = function ($node) use ($lastEdited) {
            if ($lastEdited == $node['id']) {
                return;
            }

            return sprintf(
                '<li class="table-row-style list_item" id="listItem_%s">',
                $node['id']
            );
        };

        $childClose = function ($node) use ($lastEdited, $admin, $controller) {
            if ($lastEdited == $node['id']) {
                return;
            }

            return $controller->renderView(
                '@NetworkingInitCms/MenuItemAdmin/placement_item_end.html.twig',
                ['admin' => $admin, 'last_edited' => $lastEdited, 'node' => $node]
            );
        };

        $rootOpen = function ($tree) {
            $node = $tree[0];
            if ($node['lvl'] == 1) {
                $class = 'ui-sortable';
            } else {
                $class = 'table-row-style';
            }

            return sprintf('<ul class="%s">', $class);
        };

        $navigation = $menuItemManager->childrenHierarchy(
            $rootNode,
            null,
            [
                'rootOpen' => $rootOpen,
                'decorate' => true,
                'childOpen' => $childOpen,
                'childClose' => $childClose,
                'nodeDecorator' => $nodeDecorator,
            ],
            false
        );

        return $navigation;
    }
533731
public function add_primary_action($action) {
        if ($action instanceof action_link || $action instanceof pix_icon) {
            $action->attributes['role'] = 'menuitem';
            if ($action instanceof action_menu_link) {
                $action->actionmenu = $this;
            }
        }
        $this->primaryactions[] = $action;
    }
450136
public function addButton($label, $meta = array())
    {
        $objButton = new Button($label, $meta);
        // *** Set the parent for the new field.
        $objButton->setMeta("parent", $this, true);

        $this->__fields->addObject($objButton);

        return $objButton;
    }
976983
public function beforeRender(Controller $controller) {
        $badges = array();

        foreach (Configure::read('Admin.menu') as $section => $menu) {
            $badges[$section] = $menu['count'];
        }

        $controller->set('badgeCounts', $badges);

        if (isset($controller->Model)) {
            $controller->set('model', $controller->Model);
        }

        if (isset($controller->request->params['override'])) {
            $controller->layout = 'Admin.admin';
            $controller->request->params['action'] = str_replace('admin_', '', $controller->action);
        }
    }