예제 #1
0
 protected function _render($viewFile, $data = array())
 {
     // @codingStandardsIgnoreEnd
     if (empty($data)) {
         $data = $this->viewVars;
     }
     if (substr($viewFile, -3) === 'ctp') {
         $out = parent::_render($viewFile, $data);
         // @codingStandardsIgnoreStart
     } else {
         // @codingStandardsIgnoreEnd
         $data = array_merge($data, $this->helperList, ['_view' => $this]);
         // @codingStandardsIgnoreStart
         $out = $this->getTwig()->loadTemplate($viewFile)->render($data);
         // @codingStandardsIgnoreEnd
     }
     return $out;
 }
예제 #2
0
 /**
  * Renders and returns output for given template filename with its array of data.
  * Handles parent/extended templates.
  *
  * @param string    $viewFile
  * @param array     $data
  * @return string
  */
 protected function _render($viewFile, $data = [])
 {
     if (empty($data)) {
         $data = $this->viewVars;
     }
     if (substr($viewFile, -3) === 'ctp') {
         $out = parent::_render($viewFile, $data);
     } else {
         $viewFile = str_replace($this->_templatePath, '', $viewFile);
         $data = array_merge($data, ['view' => $this]);
         $out = $this->renderer->render($viewFile, $data);
     }
     return $out;
 }