/** * Action to edit the properties of a widget * @param string $widgetId Id of the widget * @return null */ public function propertiesAction($widgetId) { $locale = I18n::getInstance()->getLocale(); $locale = $locale->getCode(); $widgetModel = WidgetModel::getInstance(); $widget = $this->dashboard->getWidget($widgetId); $instance = $widgetModel->getWidget($widget->getNamespace(), $widget->getName()); $instance->setProperties($widget->getWidgetProperties()); $instance->setLocale($locale); $baseUrl = $this->request->getBasePath(); $basePath = $this->request->getBasePath() . '/properties/' . $widgetId; $controller = get_class($instance); $action = Widget::METHOD_PROPERTIES; $parameters = array_slice(func_get_args(), 2); $request = new Request($baseUrl, $basePath, $controller, $action, $parameters); $widgetDispatcher = new WidgetDispatcher(); $widgetDispatcher->setWidget($instance); $widgetDispatcher->dispatch($request, $this->response, false); if ($this->response->willRedirect()) { $this->response->setView(null); return; } $propertiesView = $this->response->getView(); $view = new WidgetPropertiesView($instance->getName(), $propertiesView); $this->response->setView($view); }