/** * Enable Action for an entity * * @param LibBaseTemplateObject $command Command Object * * @return void */ protected function _commandEnable($command) { $entity = $this->getController()->getItem(); $label = JText::_('COM-TODOS-ACTION-' . strtoupper($entity->enabled ? 'disable' : 'enable')); $action = $entity->enabled ? 'disable' : 'enable'; $command->append(array('label' => $label)); if ($command->ajax) { $command->href($entity->getURL() . '&layout=list')->setAttribute('data-action', $action); } else { $command->href($entity->getURL() . '&action=' . $action)->setAttribute('data-trigger', 'PostLink'); } }
/** * View Stories * * @param LibBaseTemplateObject $command The command object * * @return void */ protected function _commandView($command) { $entity = $this->getController()->getItem(); $label = sprintf(JText::_('COM-STORIES-VIEW-ALL-COMMENTS'), $entity->getNumOfComments()); $command->append(array('label' => $label)); $command->href(JRoute::_($entity->getURL())); }
/** * Restore command * * @param LibBaseTemplateObject $command Command object * * @return void */ protected function _commandRestore($command) { $entity = $this->getController()->getItem(); $command->append(array('label' => JText::_('COM-PAGES-PAGE-REVISION-RESTORE'))); $command->href('option=com_pages&view=revision&action=restore&id=' . $entity->id)->setAttribute('data-trigger', 'Submit'); }
/** * Method to build a command. * * @param LibBaseTemplateObject $command The action object */ protected function _buildCommand($command) { $url = $command->receiver->getURL(); $command->setAttribute('data-action', $command->action); $command->setAttribute('data-actor', $command->actor->id); if (!$this->_use_post && $this->getController()->getRequest()->getFormat() != 'json') { $url .= '&layout=list'; } $command->href($url); }