Elgg  Version 4.3
save.php
Go to the documentation of this file.
1 <?php
13 $guid = (int) get_input('guid');
14 $params = (array) get_input('params');
15 $default_widgets = (int) get_input('default_widgets', 0);
16 $context = get_input('context');
17 
19 if (!$widget instanceof \ElggWidget || !$widget->saveSettings($params)) {
20  return elgg_error_response(elgg_echo('widgets:save:failure'));
21 }
22 
24 
25 if ($default_widgets) {
26  $context_stack[] = 'default_widgets';
27 }
28 $context_stack[] = 'widgets';
29 if ($context) {
31 }
32 
33 foreach ($context_stack as $ctx) {
34  elgg_push_context($ctx);
35 }
36 
37 elgg_set_page_owner_guid($widget->getContainerGUID());
38 
40  'content' => elgg_view('object/widget/elements/content', ['entity' => $widget]),
41  'title' => $widget->getDisplayName(),
42  'href' => $widget->getURL(),
43 ];
44 foreach ($context_stack as $ctx) {
46 }
47 
$default_widgets
Definition: save.php:15
$params
Saves global plugin settings.
Definition: save.php:13
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: context.php:52
$context
Definition: save.php:16
$widget
Definition: save.php:18
if(!$widget instanceof\ElggWidget||!$widget->saveSettings($params)) $context_stack
Definition: save.php:23
$guid
Definition: save.php:14
elgg_echo($message_key, array $args=[], $language="")
Elgg language module Functions to manage language and translations.
Definition: languages.php:18
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:34
elgg_pop_context()
Removes and returns the top context string from the stack.
Definition: context.php:62
$output
Definition: save.php:39
get_input($variable, $default=null, $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_error_response($message= '', $forward_url=REFERRER, int $status_code=ELGG_HTTP_BAD_REQUEST)
Prepare an error response to be returned by a page or an action handler.
elgg_ok_response($content= '', $message= '', $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:179
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:69