Beispiel #1
0
 /**
  * Set inflector
  *
  * @param  IfwPsn_Vendor_Zend_Filter_Inflector $inflector
  * @param  boolean               $reference Whether the moduleDir, target, and suffix should be set as references to ViewRenderer properties
  * @return IfwPsn_Vendor_Zend_Controller_Action_Helper_ViewRenderer Provides a fluent interface
  */
 public function setInflector(IfwPsn_Vendor_Zend_Filter_Inflector $inflector, $reference = false)
 {
     $this->_inflector = $inflector;
     if ($reference) {
         $this->_inflector->setStaticRuleReference('suffix', $this->_viewSuffix)->setStaticRuleReference('moduleDir', $this->_moduleDir)->setTargetReference($this->_inflectorTarget);
     }
     return $this;
 }
Beispiel #2
0
 /**
  * Render layout
  *
  * Sets internal script path as last path on script path stack, assigns
  * layout variables to view, determines layout name using inflector, and
  * renders layout view script.
  *
  * $name will be passed to the inflector as the key 'script'.
  *
  * @param  mixed $name
  * @return mixed
  */
 public function render($name = null)
 {
     if (null === $name) {
         $name = $this->getLayout();
     }
     if ($this->inflectorEnabled() && null !== ($inflector = $this->getInflector())) {
         $name = $this->_inflector->filter(array('script' => $name));
     }
     $view = $this->getView();
     if (null !== ($path = $this->getViewScriptPath())) {
         if (method_exists($view, 'addScriptPath')) {
             $view->addScriptPath($path);
         } else {
             $view->setScriptPath($path);
         }
     } elseif (null !== ($path = $this->getViewBasePath())) {
         $view->addBasePath($path, $this->_viewBasePrefix);
     }
     return $view->render($name);
 }