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 
23 elgg_push_breadcrumb(elgg_echo('settings'), elgg_generate_url('settings:account', ['username' => $user->username]));
24 
26 if (elgg_action_exists("{$plugin_id}/usersettings/save")) {
27  $form_vars['action'] = "action/{$plugin_id}/usersettings/save";
28 }
29 
30 $content = elgg_view_form('plugins/usersettings/save', $form_vars, ['entity' => $plugin]);
31 
32 echo elgg_view_page($title, [
33  'content' => $content,
34  'show_owner_block_menu' => false,
35  'filter_id' => 'settings',
36  'filter_value' => 'plugin_settings',
37 ]);
elgg_push_breadcrumb(string $text, string|false $href=false)
Breadcrumbs.
Definition: breadcrumbs.php:16
elgg_view_form(string $action, array $form_vars=[], array $body_vars=[])
Definition: views.php:1054
$plugin
Definition: tools.php:12
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:25
elgg_view_page(string $title, string|array $body, string $page_shell= 'default', array $vars=[])
Assembles and outputs a full page.
Definition: views.php:256
$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:30
elgg_generate_url(string $name, array $parameters=[])
Generate a URL for named route.
$vars['head']
Definition: html.php:24