/**
  * @param WidgetManagerDashboard $widgetManager
  *
  * @throws \Exception
  * @throws \Throwable
  */
 public function postWidget(WidgetManagerDashboard $widgetManager)
 {
     $widgetId = $this->getRequiredParameter('id');
     $settings = $this->getParameter('settings', []);
     $widget = $widgetManager->updateWidget($widgetId, $settings);
     if ($widget instanceof WidgetDashboard) {
         $this->setContent(['widget' => $widget->toArray(), 'template' => (string) (new WidgetRenderSettingsHTML($widget))->render()]);
     }
 }
 /**
  * Decorator constructor.
  *
  * @param WidgetManagerDashboard $widgetManager
  */
 public function __construct(WidgetManagerDashboard $widgetManager)
 {
     $this->relatedWidgets = new Collection();
     $this->widgetManager = $widgetManager;
     $this->type = $this->widgetManager->getTypeByClassName(get_called_class());
 }