/** * 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'); } }
/** * Enable/Disable action * * @param LibBaseTemplateObject $command The action object * * @return void */ protected function _commandEnable($command) { $entity = $this->getController()->getItem(); $label = JText::_('LIB-AN-ACTION-' . strtoupper($entity->enabled ? 'disable' : 'enable')); $command->append(array('label' => $label))->href($entity->getURL() . '&action=' . ($entity->enabled ? 'disable' : 'enable'))->setAttribute('data-trigger', 'Submit'); }
/** * Delete Command for an entity. * * @param LibBaseTemplateObject $command The action object */ protected function _commandDelete($command) { $entity = $this->getController()->getItem(); $command->append(array('label' => JText::_('LIB-AN-ACTION-DELETE')))->href(JRoute::_($entity->getURL()))->setAttribute('data-action', 'delete')->setAttribute('data-redirect', JRoute::_('index.php?option=com_locations&view=locations'))->class('action-delete'); }
/** * 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'); }
/** * New button toolbar * * @param LibBaseTemplateObject $command The action object * * @return void */ protected function _commandNew($command) { $command->append(array('label' => JText::_('COM-TODOS-TOOLBAR-TODO-NEW')))->href('#')->setAttribute('data-trigger', 'ReadForm'); }
/** * Add Followers button toolbar. * * @param LibBaseTemplateObject $command The action object */ protected function _commandAddFollowers($command) { $actor = $command->actor; $labels = array(); $labels[] = strtoupper('com-' . $this->getIdentifier()->package . '-socialgraph-toolbar-followers-add'); $labels[] = 'COM-ACTORS-SOCIALGRAPH-TOOLBAR-FOLLOWERS-ADD'; $label = translate($labels); $url = $actor->getURL() . '&get=graph&type=leadables'; $command->append(array('label' => $label))->href($url)->id('leadables-add'); }
/** * Delete Command for a story * * @param LibBaseTemplateObject $command The command object * * @return void */ protected function _commandDelete($command) { $entity = $this->getController()->getItem(); $link = 'option=com_stories&view=story'; foreach ($entity->getIds() as $id) { $link .= '&id[]=' . $id; } $command->append(array('label' => JText::_('LIB-AN-ACTION-DELETE')))->href(JRoute::_($link))->setAttribute('data-action', 'delete')->class('action-delete'); }
/** * New button toolbar. * * @param LibBaseTemplateObject $command The action object */ protected function _commandNew($command) { $actor = $this->getController()->actor; $name = $this->getController()->getIdentifier()->name; $labels = array(); $labels[] = strtoupper('com-' . $this->getIdentifier()->package . '-toolbar-' . $name . '-new'); $labels[] = 'New'; $label = translate($labels); $url = 'option=com_' . $this->getIdentifier()->package . '&view=' . $name . '&oid=' . $actor->id . '&layout=add'; $command->append(array('label' => $label))->href(JRoute::_($url)); }
/** * New button toolbar. * * @param LibBaseTemplateObject $command The action object */ protected function _commandNew($command) { $name = $this->getController()->getIdentifier()->name; $command->append(array('label' => JText::_('COM-UBSCRIPTIONS-TOOLBAR-' . $name . '-NEW')))->href('#')->setAttribute('data-trigger', 'ReadForm'); }
/** * Customize the sticky command. * * @param LibBaseTemplateObject $command Command Object */ protected function _commandPin($command) { $entity = $this->getController()->getItem(); $label = $entity->pinned ? JTEXT::_('LIB-AN-ACTION-UNPIN') : JTEXT::_('LIB-AN-ACTION-PIN'); $command->append(array('label' => $label))->href($entity->getURL() . '&action=' . ($entity->pinned ? 'unpin' : 'pin'))->setAttribute('data-trigger', 'PostLink'); }