Elgg  Version master
tools.php
Go to the documentation of this file.
1 <?php
7 
9 
10 $plugin_id = (string) elgg_extract('plugin_id', $vars);
11 
13 if (!$plugin instanceof \ElggPlugin) {
14  throw new PageNotFoundException(elgg_echo('PluginException:InvalidID', [$plugin_id]));
15 }
16 
17 if (elgg_language_key_exists("{$plugin_id}:usersettings:title")) {
18  $title = elgg_echo("{$plugin_id}:usersettings:title");
19 } else {
20  $title = $plugin->getDisplayName();
21 }
22 
24 if (elgg_action_exists("{$plugin_id}/usersettings/save")) {
25  $form_vars['action'] = "action/{$plugin_id}/usersettings/save";
26 }
27 
28 $content = elgg_view_form('plugins/usersettings/save', $form_vars, ['entity' => $plugin]);
29 
30 echo elgg_view_page($title, [
31  'content' => $content,
32  'show_owner_block_menu' => false,
33  'filter_id' => 'settings',
34  'filter_value' => 'plugin_settings',
35 ]);
elgg_view_form(string $action, array $form_vars=[], array $body_vars=[])
Definition: views.php:1033
$plugin
Definition: tools.php:12
Plugin class containing helper functions for plugin activation/deactivation, dependency checking capa...
Definition: ElggPlugin.php:17
elgg_get_plugin_from_id(string $plugin_id)
Elgg plugins library Contains functions for managing plugins.
Definition: plugins.php:15
$title
Definition: generic.php:50
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$user
Definition: tools.php:8
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_language_key_exists(string $key, string $language= 'en')
Check if a given language key exists.
Definition: languages.php:44
Thrown when page is not accessible.
elgg_action_exists(string $action)
Check if an action is registered and its script exists.
Definition: actions.php:68
$form_vars
Definition: tools.php:23
elgg_view_page(string $title, string|array $body, string $page_shell= 'default', array $vars=[])
Assembles and outputs a full page.
Definition: views.php:235
$plugin_id
Definition: tools.php:10
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:23
if(elgg_action_exists("{$plugin_id}/usersettings/save")) $content
Definition: tools.php:28
$vars
Definition: theme.php:5