/** * Method to run this controller. * * @return mixed A rendered view or true */ protected function doExecute() { // Display the view $config = $this->container->get('joomla.config'); if ($this->cachable && $this->format != 'feed' && $config->get('caching') >= 1) { $option = $this->input->get('option'); $cache = \JFactory::getCache($option, 'view'); // Register url params for JCache. if (is_array($this->urlParams)) { if (!empty($this->app->registeredurlparams)) { $registeredurlparams = $this->app->registeredurlparams; } else { $registeredurlparams = new \StdClass(); } foreach ($this->urlParams as $key => $value) { // Add your safe url parameters with variable type as value {@see JFilterInput::clean()}. $registeredurlparams->{$key} = $value; } $this->app->registeredurlparams = $registeredurlparams; } return $cache->get($this->view, 'render'); } // Set sub models foreach ($this->subModels as $subModel) { $this->view->setModel($subModel); } return $this->view->render(); }
/** * Method to instantiate the view. * * @param Model $model The model object. * @param Container $container DI Container. * @param array $config View config. * @param \SplPriorityQueue $paths Paths queue. */ public function __construct(Model $model = null, Container $container = null, $config = array(), \SplPriorityQueue $paths = null) { if (!empty($config['engine']) && $config['engine'] instanceof EngineInterface) { $this->engine = $config['engine']; } parent::__construct($model, $container, $config); // Setup dependencies. $this->paths = $paths ?: $this->loadPaths(); }
/** * fromView * * @param AbstractView $view * @param string $suffix * * @return string * * @throws \Exception */ public static function fromView(AbstractView $view, $suffix = null) { $suffix = $suffix ? '.' . trim($suffix, '.') : null; return $view->getOption() . '.' . $view->getName() . $suffix; }
/** * Method to instantiate the view. * * @param Model $model The model object. * @param Container $container DI Container. * @param array $config View config. */ public function __construct(Model $model = null, Container $container = null, $config = array()) { parent::__construct($model, $container, $config); $this->data = new Registry(); }