/** * Decorate Notifier * * Automatically attach the decorate toolbar if the delegate has previously already been attached. This will * subscribe the decorator to the event dispatcher. * * @param object $delegate The object being decorated * @return void * @throws \InvalidArgumentException If the delegate is not an object * @see ControllerToolbarMixin::attachToolbar() */ public function onDecorate($delegate) { $controller = $delegate->getController(); if ($controller->inherits('Nooku\\Library\\ControllerToolbarMixin')) { if ($controller->hasToolbar($delegate->getType())) { $controller->detachToolbar($delegate); $controller->attachToolbar($this); } } parent::onDecorate($delegate); }
/** * Decorate Notifier * * Automatically attach the decorate toolbar if the delegate has previously already been attached. This will * subscribe the decorator to the event dispatcher. * * @param object $delegate The object being decorated * @return void * @throws \InvalidArgumentException If the delegate is not an object * @see ControllerToolbarMixin::attachToolbar() */ public function onDecorate($delegate) { $controller = $delegate->getController(); if ($controller->isCommandable()) { $type = $delegate->getType(); if ($controller->hasToolbar($type)) { $controller->removeToolbar($delegate); $controller->addToolbar($this); } } parent::onDecorate($delegate); }