Elgg  Version master
save.php
Go to the documentation of this file.
1 <?php
9 $widget = elgg_extract('entity', $vars);
10 if (!$widget instanceof \ElggWidget) {
11  return;
12 }
13 
15 if (elgg_view_exists("widgets/{$widget->handler}/edit")) {
16  $custom_form_section = elgg_view("widgets/{$widget->handler}/edit", ['entity' => $widget]);
17 }
18 
19 $access = '';
20 if (elgg_extract('show_access', $vars, true)) {
22  '#type' => 'access',
23  '#label' => elgg_echo('access'),
24  'name' => 'params[access_id]',
25  'value' => $widget->access_id,
26  'entity' => $widget,
27  ]);
28 }
29 
31  return;
32 }
33 
35 echo $access;
36 
37 echo elgg_view_field([
38  '#type' => 'hidden',
39  'name' => 'guid',
40  'value' => $widget->guid,
41 ]);
42 
43 if (elgg_in_context('default_widgets')) {
44  echo elgg_view_field([
45  '#type' => 'hidden',
46  'name' => 'default_widgets',
47  'value' => 1,
48  ]);
49 }
50 
52  '#type' => 'submit',
53  'text' => elgg_echo('save'),
54 ]);
55 
if(!$widget instanceof\ElggWidget) $custom_form_section
Definition: save.php:14
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
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:19
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:156
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:1046
$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:131