aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-12 16:44:09 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-12 16:44:09 +0000
commite2d271292538609339f08b76633c639edfb6ad99 (patch)
tree4ba08d3a2986105ff7194aa91180c0258da9a079 /engine/lib
parent555c4065732ec8a5795943cb4ae3a61e675825ec (diff)
downloadelgg-e2d271292538609339f08b76633c639edfb6ad99.tar.gz
elgg-e2d271292538609339f08b76633c639edfb6ad99.tar.bz2
Extra helpful widgets functions
git-svn-id: https://code.elgg.org/elgg/trunk@897 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/widgets.php20
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;
}