Elgg  Version master
plugin_settings.php
Go to the documentation of this file.
1 <?php
10 
11 // Make sure the 'site' css isn't loaded
12 elgg_unregister_external_file('css', 'elgg');
13 
14 $plugin_id = (string) elgg_extract('plugin_id', $vars);
15 
17 if (!$plugin instanceof \ElggPlugin) {
18  throw new EntityNotFoundException();
19 }
20 
21 if (!elgg_view_exists("plugins/{$plugin_id}/settings")) {
22  throw new PageNotFoundException();
23 }
24 
25 // build page elements
26 $title = elgg_echo('admin:plugin_settings') . ': ' . $plugin->getDisplayName();
27 
28 $content = elgg_view('admin/plugin_settings', [
29  'entity' => $plugin,
30 ]);
31 
32 if (empty($content)) {
33  throw new PageNotFoundException(elgg_echo('admin:unknown_section'));
34 }
35 
36 // build page
37 $body = elgg_view_layout('admin', [
38  'title' => $title,
39  'content' => $content,
40  'filter_id' => 'admin/plugin_settings',
41  'filter_value' => $plugin_id,
42 ]);
43 
44 // draw page
45 echo elgg_view_page($title, $body, 'admin');
elgg_view_layout(string $layout_name, array $vars=[])
Displays a layout with optional parameters.
Definition: views.php:352
if(empty($content)) $body
$plugin_id
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
elgg_unregister_external_file(string $type, string $name)
Unregister an external file.
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
if(!$plugin instanceof\ElggPlugin) if(!elgg_view_exists("plugins/{$plugin_id}/settings")) $title
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
Thrown when page is not accessible.
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
Elgg plugin settings.
$vars
Definition: theme.php:5
Aggregate action for saving settings.
elgg_view_exists(string $view, string $viewtype= '', bool $recurse=true)
Returns whether the specified view exists.
Definition: views.php:131
$content