/** * @param WidgetManagerDashboard $widgetManager * * @throws \Exception * @throws \Throwable */ public function putWidget(WidgetManagerDashboard $widgetManager) { $widgetType = $this->getRequiredParameter('widget_type'); $widget = $widgetManager->addWidget($widgetType); $this->setContent(['widget' => $widget->toArray(), 'template' => (string) (new WidgetRenderDashboardHTML($widget))->render()]); }