/** * Before Controller _actionRead is executed. * * @param KEvent $event */ public function onBeforeControllerGet(KEvent $event) { parent::onBeforeControllerGet($event); if ($this->getController()->getItem()) { $this->addToolbarCommands(); } }
/** * Initializes the default configuration for the object. * * Called from {@link __construct()} as a first step of object instantiation. * * @param KConfig $config An optional KConfig object with configuration options. */ protected function _initialize(KConfig $config) { //@todo not crazy about this approach, but there was no way //that I could obtain the locatable from the controller $locatable_id = KRequest::get('get.locatable_id', 'int', 0); if (!$this->_locatable && $locatable_id) { $this->_locatable = KService::get('repos:nodes.node')->getQuery()->id($locatable_id)->fetch(); } parent::_initialize($config); }