Elgg  Version 1.9
save.php
Go to the documentation of this file.
1 <?php
18 elgg_set_context('widgets');
19 
20 $guid = get_input('guid');
21 $params = get_input('params');
22 $default_widgets = get_input('default_widgets', 0);
23 $context = get_input('context');
24 $title = get_input('title');
25 
27 if ($widget && $widget->saveSettings($params)) {
28  if ($title && $title != $widget->title) {
29  $widget->title = $title;
30  $widget->save();
31  }
32 
33  elgg_set_page_owner_guid($widget->getContainerGUID());
34  if ($context) {
36  }
37 
38  if (!$default_widgets) {
39  if (elgg_view_exists("widgets/$widget->handler/content")) {
40  $view = "widgets/$widget->handler/content";
41  } else {
42  elgg_deprecated_notice("widgets use content as the display view", 1.8);
43  $view = "widgets/$widget->handler/view";
44  }
45  echo elgg_view($view, array('entity' => $widget));
46  }
47 } else {
48  register_error(elgg_echo('widgets:save:failure'));
49 }
50 
$view
Definition: crop.php:68
$guid
Definition: save.php:53
$params
Definition: save.php:15
$default_widgets
Definition: save.php:22
$widget
Definition: save.php:26
$title
Definition: save.php:24
$context
Definition: save.php:23
register_error($error)
Display an error on next page load.
Definition: elgglib.php:605
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Sends a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:1171
const REFERER
Definition: elgglib.php:2162
forward($location="", $reason='system')
Forward to $location.
Definition: elgglib.php:79
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:604
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:73
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:243
elgg_set_context($context)
Sets the page context.
Definition: pageowner.php:201
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype='')
Return a parsed view.
Definition: views.php:354
elgg_view_exists($view, $viewtype='', $recurse=true)
Returns whether the specified view exists.
Definition: views.php:318