diff options
-rw-r--r-- | engine/lib/widgets.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index 8d44e14a8..bf36cf001 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -246,11 +246,25 @@ if ($widget->subtype != "widget") return false;
$handler = $widget->handler;
- if (empty($handler)) return false;
+ if (empty($handler) || !widget_type_exists($handler)) return false;
+
+ // Save the params to the widget
+ if (is_array($params) && sizeof($params) > 0) {
+ foreach($params as $name => $value) {
+ if (!empty($name) && !in_array($name,array(
+ 'guid','owner_guid','access_id','site_guid'
+ ))) {
+ $widget->$name = $value;
+ }
+ }
+ }
+
$function = "save_{$handler}_widget";
- if (!is_callable($function)) return false;
+ if (is_callable($function)) {
+ return $function($params);
+ }
- return $function($params);
+ return true;
}
|