Elgg  Version 3.0
save.php
Go to the documentation of this file.
1 <?php
16 $guid = (int) get_input('guid');
17 $params = (array) get_input('params');
18 $default_widgets = (int) get_input('default_widgets', 0);
19 $context = get_input('context');
20 
22 if (!($widget instanceof \ElggWidget) || !$widget->saveSettings($params)) {
23  return elgg_error_response(elgg_echo('widgets:save:failure'));
24 }
25 
27 
28 if ($default_widgets) {
29  $context_stack[] = 'default_widgets';
30 }
31 $context_stack[] = 'widgets';
32 if ($context) {
34 }
35 
36 foreach ($context_stack as $ctx) {
37  elgg_push_context($ctx);
38 }
39 
40 elgg_set_page_owner_guid($widget->getContainerGUID());
41 
43  'content' => elgg_view('object/widget/elements/content', ['entity' => $widget]),
44  'title' => $widget->getDisplayName(),
45  'href' => $widget->getURL(),
46 ];
47 foreach ($context_stack as $ctx) {
49 }
50 
$default_widgets
Definition: save.php:18
$params
Saves global plugin settings.
Definition: save.php:13
$guid
Definition: save.php:48
$context
Definition: save.php:19
$widget
Definition: save.php:21
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:81
$output
Definition: save.php:42
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_error_response($error= '', $forward_url=REFERRER, $status_code=ELGG_HTTP_OK)
Prepare an error response to be returned by a page or an action handler.
if(!($widget instanceof\ElggWidget)||!$widget->saveSettings($params)) $context_stack
Definition: save.php:26
elgg_pop_context()
Removes and returns the top context string from the stack.
Definition: pageowner.php:222
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:212
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:87