Пример #1
0
 public function after(ResponseBag $bag)
 {
     $this->bag = $bag;
     $actionResult = $bag->get(ResponseBag::ACTION_RESULT, false);
     $hasActionResult = !(false === $actionResult);
     $this->bag->set('request', $this->request);
     if (!$hasActionResult && $this->hasDefaultTemplate()) {
         $bag->setResult($this->getDefaultTemplate());
         return;
     }
     if ($this->hasTemplate($actionResult)) {
         $bag->setResult($this->renderTemplate($actionResult));
         return;
     }
 }
Пример #2
0
 protected function after(ResponseBag $bag)
 {
     $out = self::PLACEHOLDER_DEFAULT;
     $template = $this->config[0];
     if (count($this->config) > 1) {
         $out = $this->config[1];
     }
     $path = $this->viewPath . '/' . $template;
     $view = new View($path, $bag);
     $content = $view->render();
     if ($out == self::PLACEHOLDER_DEFAULT) {
         $bag->setResult($content);
     } else {
         $bag->set('__placeholder__' . $out, $content);
     }
 }