/** * Returned a rendered widget * * @param string $alias * * @return \Symfony\Component\HttpFoundation\Response */ public function showAction($alias) { if (null === ($widget = $this->widgetRegistry->get($alias))) { return $this->render('PimDashboardBundle:Widget:error.html.twig', array('alias' => $alias)); } return $this->render($widget->getTemplate(), array('widget' => $widget->getParameters())); }
/** * Return data for a widget * * @param string $alias * * @return JsonResponse */ public function dataAction($alias) { $widget = $this->widgetRegistry->get($alias); $data = null !== $widget ? $widget->getData() : null; return new JsonResponse($data); }