protected function _afterBrowse(KControllerContextInterface $context) { parent::_afterBrowse($context); $this->removeCommand('new'); $this->removeCommand('delete'); $this->addCommand('enable'); $this->addCommand('disable'); }
public function getCommands() { // Only display add document button if the user has access to add documents and if the button should be shown $params = JFactory::getApplication()->getMenu()->getActive()->params; if($this->getController()->canAdd() && $params->get('show_add_document_button')) { $this->addCommand('new'); } return parent::getCommands(); }
protected function _afterBrowse(KControllerContextInterface $context) { parent::_afterBrowse($context); $controller = $this->getController(); $this->addSeparator(); $this->addPublish(array('allowed' => $controller->canEdit())); $this->addUnpublish(array('allowed' => $controller->canEdit())); if ($controller->canBrowse()) { $this->addSeparator()->addExport(); } if ($controller->canAdmin()) { $this->addSeparator()->addOptions(); } }
protected function _afterRead(KControllerContextInterface $context) { parent::_afterRead($context); $controller = $this->getController(); $allowed = $controller->{$context->result->isNew() ? 'canAdd' : 'canEdit'}(); if ($context->result->isLockable() && $context->result->isLocked()) { $allowed = false; } $this->removeCommand('save')->removeCommand('apply')->removeCommand('cancel'); $this->addCommand('apply', array('allowed' => $allowed)); $this->addCommand('save', array('allowed' => $allowed)); if (in_array($context->subject->getIdentifier()->name, array('category', 'document'))) { $this->addCommand('save2new', array('allowed' => $allowed)); } $this->addCommand('cancel'); }