Elgg  Version master
save.php
Go to the documentation of this file.
1 <?php
6 $plugin = elgg_extract('entity', $vars);
7 $plugin_id = $plugin->getID();
9 
10 // Do we want to show admin settings or user settings
11 $type = elgg_extract('type', $vars, '');
12 if ($type != 'user') {
13  $type = '';
14 }
15 
16 $settings = '';
17 if (elgg_view_exists("plugins/{$plugin_id}/{$type}settings")) {
18  $settings = elgg_view("plugins/{$plugin_id}/{$type}settings", $vars);
19 }
20 
21 if (empty($settings)) {
22  return;
23 }
24 
25 echo elgg_view_field([
26  '#type' => 'hidden',
27  'name' => 'plugin_id',
28  'value' => $plugin_id,
29 ]);
30 
31 echo elgg_view_field([
32  '#type' => 'hidden',
33  'name' => 'user_guid',
34  'value' => $user_guid,
35 ]);
36 
37 echo $settings;
38 
40  '#type' => 'submit',
41  'text' => elgg_echo('save'),
42 ]);
43 
$type
Definition: save.php:11
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$footer
Definition: save.php:89
if($type!= 'user') $settings
Definition: save.php:16
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
if(empty($plugin_id)) $plugin
Definition: save.php:20
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
$plugin_id
Definition: save.php:15
$vars['type']
Plugin user settings.
Definition: save.php:8
$user_guid
Definition: save.php:15
elgg_view_exists(string $view, string $viewtype= '', bool $recurse=true)
Returns whether the specified view exists.
Definition: views.php:131
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:34