public function onHeadEnd(\CmsModule\Events\RenderArgs $args) { if ($this->analyticsManager->getActivated() && $args->getPresenter() instanceof PagePresenter) { $control = $this->widgetManager->getWidget('googleAnalytics')->invoke(); $control->render($this->analyticsManager->getAccountId()); } }
/** * Component factory. Delegates the creation of components to a createComponent<Name> method. * * @param string component name * @return IComponent the created component (optionally) */ protected function createComponent($name) { // parent if (($control = parent::createComponent($name)) == TRUE) { return $control; } // widget from widgetManager if ($this->widgetManager->hasWidget($name)) { return $this->widgetManager->getWidget($name)->invoke(); } throw new \Nette\InvalidArgumentException("Component or widget with name '{$name}' does not exist."); }
/** * @param $element * @param $name * @param LayoutEntity $layout * @param PageEntity $page * @param RouteEntity $route * @param LanguageEntity $language * @return BaseElement */ public function createInstance($element) { return $this->widgetManager->getWidget(self::ELEMENT_PREFIX . $element)->invoke(); }