Пример #1
0
 /**
  * processes the layout if it needs to be processed
  *
  * @param Controller $controller
  * @param View $view
  * @param array $args
  * @return bool
  */
 protected function _processLayout(Controller $controller, View $view = null, $args)
 {
     // if the layout was already processed ignore this call
     if ($this->_layout_processed) {
         return false;
     }
     // if the controller doesn't have a layout ignore this call
     if (!$controller->hasLayout()) {
         return false;
     }
     // if this is not the first controller and not an exception, ignore
     if (count($this->_controllers) != 1 && !isset($args['exception'])) {
         return false;
     }
     // process the layout!
     $this->_layout_processed = true;
     $layout = $controller->getLayout();
     $layout->topView($view ?: new View());
     if ($this->_delegate) {
         $this->_delegate->layoutStartedRendering($layout);
     }
     $layout->output();
     if ($this->_delegate) {
         $this->_delegate->layoutFinishedRendering($layout);
     }
     return true;
 }