/** * Edit Command for an entity * * @param LibBaseTemplateObject $command The action object * * @return void */ protected function _commandEdit($command) { $entity = $this->getController()->getItem(); $view = $this->getController()->getView()->getName(); $layout = pick($command->layout, 'edit'); $command->append(array('label' => JText::_('LIB-AN-ACTION-EDIT')))->href($entity->getURL() . '&layout=' . $layout); if (KInflector::isPlural($view)) { $command->setAttribute('data-action', 'edit'); } }
/** * Delete a location from a locatable entity * * @param LibBaseTemplateObject $command The action object */ protected function _commandDeleteLocation($command) { $location = $this->getController()->getItem(); $locatable = $command->locatable; $command->setAttribute('data-action', 'deleteLocation')->setAttribute('data-location', $location->id)->href($locatable->getURL()); $command->label = translate('LIB-AN-ACTION-DELETE'); }
/** * 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); }