Exemplo n.º 1
0
 /**
  * Add a plugin for use by this view.
  *
  * @param View   $plugin
  * @param string $name
  *
  * @return $this
  */
 public function addPlugin(View $plugin, $name = '')
 {
     if (empty($name)) {
         $this->plugins->append($plugin);
     } else {
         /*
          * Set value using both methods to work around isset() bug.
          */
         $this->plugins->{$name} = $plugin;
         $this->plugins[$name] = $plugin;
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Add a plugin for use by this controller.
  *
  * @param Controller $plugin
  * @param string     $name
  *
  * @return $this
  */
 protected function registerPlugin(Controller $plugin, $name = '')
 {
     if (empty($name)) {
         $this->plugins->append($plugin);
     } else {
         $this->plugins->{$name} = $plugin;
     }
     /*
      * Allow late registration of plugins
      */
     if ($this->running) {
         $this->view->addPlugin($plugin->run($this->params), $name);
     }
     return $this;
 }