Exemple #1
0
 /**
  * render the Widget
  * @param Widget $widget
  * @param View   $view
  *
  * @return widget show
  */
 public function render(Widget $widget, View $view)
 {
     //the mode of display of the widget
     $mode = $widget->getMode();
     //if entty is given and it's not the object, retrive it and set the entity for the widget
     if ($mode == Widget::MODE_BUSINESS_ENTITY && $view instanceof BusinessEntityPage) {
         $widget->setEntity($view->getBusinessEntity());
     }
     //the templating service
     $templating = $this->container->get('victoire_templating');
     //the content of the widget
     $parameters = $this->container->get('victoire_widget.widget_content_resolver')->getWidgetContent($widget);
     //the template displayed is in the widget bundle (with the potential theme)
     $showView = 'show' . ucfirst($widget->getTheme());
     $templateName = $this->container->get('victoire_widget.widget_helper')->getTemplateName($showView, $widget);
     return $templating->render($templateName, $parameters);
 }