aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/widgets/add.php5
-rw-r--r--actions/widgets/save.php11
2 files changed, 7 insertions, 9 deletions
diff --git a/actions/widgets/add.php b/actions/widgets/add.php
index 6c2859c21..cdb26ef07 100644
--- a/actions/widgets/add.php
+++ b/actions/widgets/add.php
@@ -14,10 +14,11 @@ $column = get_input('column', 1);
if (!empty($user_guid)) {
$user = get_entity($user_guid);
if ($user && $user->canEdit()) {
- $guid = elgg_create_widget($user->getGUID(), $handler);
+ $guid = elgg_create_widget($user->getGUID(), $handler, $context);
if ($guid) {
$widget = get_entity($guid);
- $widget->setContext($context);
+
+ // position the widget
$widget->move($column, 0);
// send widget html for insertion
diff --git a/actions/widgets/save.php b/actions/widgets/save.php
index 13ea90e85..8854d7810 100644
--- a/actions/widgets/save.php
+++ b/actions/widgets/save.php
@@ -9,15 +9,12 @@
$guid = get_input('guid');
$params = get_input('params');
-$result = elgg_save_widget_settings($guid, $params);
-
-if (!$result) {
- register_error(elgg_echo('widgets:save:failure'));
-} else {
- // send back the widget contents
- $widget = get_entity($guid);
+$widget = get_entity($guid);
+if ($widget && $widget->saveSettings($params)) {
$view = "widgets/$widget->handler/view";
echo elgg_view($view, array('entity' => $widget));
+} else {
+ register_error(elgg_echo('widgets:save:failure'));
}
forward(REFERER); \ No newline at end of file