Esempio n. 1
0
 /**
  * Set view property.
  *
  * @param Zikula_View $view Default null means new Render instance for this module name.
  *
  * @return Zikula_Controller_AbstractPlugin
  */
 protected function setView(Zikula_View $view = null)
 {
     // please note the docblock param signature is deliberately different to the method signature - drak
     if (is_null($view)) {
         if ($this->plugin->getPluginType() == Zikula_AbstractPlugin::TYPE_MODULE) {
             $view = Zikula_View_Plugin::getModulePluginInstance($this->moduleName, $this->pluginName);
         } else {
             $view = Zikula_View_Plugin::getSystemPluginInstance($this->pluginName);
         }
     } else {
         if (!$view instanceof Zikula_View_Plugin) {
             $name = is_object($view) ? get_class($view) : '$view';
             throw new InvalidArgumentException(sprintf('%s must be an instance of Zikula_View_Plugin', $name));
         }
     }
     $this->view = $view;
     return $this;
 }