function addwidget_POST(Web $w) { $p = $w->pathMatch("module"); $module = $p["module"]; // $id = $p["id"]; // $widget = $w->Widget->getWidget($_POST["destination_module"], $_POST["source_module"], $_POST["widget_name"]); // $widget = $w->Widget->getWidgetByID($) // if (null !== $widget) { // $w->error("This entry already exists!", "/{$module}/index"); // } $widget = new WidgetConfig($w); $widget->destination_module = $module; $widget->fill($_POST); $widget->user_id = $w->Auth->user()->id; $response = $widget->insert(); if ($response === true) { $w->msg("Widget Added", "/{$module}/index"); } else { $w->error("Could not add widget", "/{$module}/index"); } }
/** * @inheritdoc */ public function getParameters() { $params = parent::getParameters(); $params['containerId'] = $this->getId(); return $params; }