Elgg  Version 5.1
save.php
Go to the documentation of this file.
1 <?php
10 $widget = elgg_extract('widget', $vars);
11 if ($widget !== null) {
12  elgg_deprecated_notice('Passing the widget entity in $vars["widget"] is deprecated. Update your code to provide it in $vars["entity"].', '5.1');
13 }
14 
15 $widget = elgg_extract('entity', $vars, $widget);
16 if (!$widget instanceof \ElggWidget) {
17  return;
18 }
19 
21 if (elgg_view_exists("widgets/{$widget->handler}/edit")) {
22  $custom_form_section = elgg_view("widgets/{$widget->handler}/edit", ['entity' => $widget]);
23 }
24 
25 $access = '';
26 if (elgg_extract('show_access', $vars, true)) {
28  '#type' => 'access',
29  '#label' => elgg_echo('access'),
30  'name' => 'params[access_id]',
31  'value' => $widget->access_id,
32  'entity' => $widget,
33  ]);
34 }
35 
37  return;
38 }
39 
41 echo $access;
42 
43 echo elgg_view_field([
44  '#type' => 'hidden',
45  'name' => 'guid',
46  'value' => $widget->guid,
47 ]);
48 
49 if (elgg_in_context('default_widgets')) {
50  echo elgg_view_field([
51  '#type' => 'hidden',
52  'name' => 'default_widgets',
53  'value' => 1,
54  ]);
55 }
56 
58  '#type' => 'submit',
59  'text' => elgg_echo('save'),
60 ]);
61 
if(!$widget instanceof\ElggWidget) $custom_form_section
Definition: save.php:20
elgg_deprecated_notice(string $msg, string $dep_version)
Log a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:115
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1133
elgg_in_context(string $context)
Check if this context exists anywhere in the stack.
Definition: context.php:78
if(elgg_view_exists("widgets/{$widget->handler}/edit")) $access
Definition: save.php:25
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$widget
Definition: save.php:18
$footer
Definition: save.php:89
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:177
elgg_set_form_footer(string $footer= '')
Sets form footer and defers its rendering until the form view and extensions have been rendered...
Definition: views.php:1067
$vars['type']
Plugin user settings.
Definition: save.php:8
elgg_view_exists(string $view, string $viewtype= '', bool $recurse=true)
Returns whether the specified view exists.
Definition: views.php:152