Craft\AmNavPlugin::addCommands PHP Method

addCommands() public method

Add commands to a&m command through this hook function.
public addCommands ( ) : array
return array
    public function addCommands()
    {
        $commands = array();
        if (craft()->userSession->getUser()->can('accessPlugin-AmNav')) {
            $pluginName = $this->getName();
            $pluginSettings = $this->getSettings();
            $commands[] = array('name' => $pluginName . ': ' . Craft::t('Build navigation'), 'more' => true, 'call' => 'getNavigationsByCommand', 'service' => 'amNav', 'vars' => array('command' => 'build'));
            if (craft()->userSession->isAdmin() || $pluginSettings->canDoActions) {
                $commands[] = array('name' => $pluginName . ': ' . Craft::t('New navigation'), 'url' => UrlHelper::getUrl('amnav/new'));
                $commands[] = array('name' => $pluginName . ': ' . Craft::t('Navigation settings'), 'more' => true, 'call' => 'getNavigationsByCommand', 'service' => 'amNav', 'vars' => array('command' => 'settings'));
            }
        }
        return $commands;
    }