/** * Handle the event. * * @param ViewComposed $event */ public function handle(ViewComposed $event) { $view = $event->getView(); if ($data = array_merge($view->getFactory()->getShared(), $view->getData())) { foreach ($data as $key => $value) { $view[$key] = $this->decorator->decorate($value); } } }
/** * Handle the event. * * @param ViewComposed $event */ public function handle(ViewComposed $event) { $view = $event->getView(); if (array_get($view->getData(), 'template')) { return; } if (!$this->template->isLoaded()) { $this->events->fire(new RegisteringTwigPlugins($this->twig)); $this->events->fire(new TemplateDataIsLoading($this->template)); $this->template->setLoaded(true); } if (array_merge($view->getFactory()->getShared(), $view->getData())) { $view['template'] = (new Decorator())->decorate($this->template); } }