Elgg  Version master
plugin.php
Go to the documentation of this file.
1 <?php
6 $plugin = elgg_extract('entity', $vars);
7 if (!($plugin instanceof \ElggPlugin)) {
8  return;
9 }
10 
11 if (!elgg_in_context('admin')) {
12  echo elgg_view('object/default', $vars);
13  return;
14 }
15 
16 try {
17  $plugin->assertValid();
18 } catch (\Elgg\Exceptions\PluginException $e) {
19  $vars['error'] = $e->getMessage();
20  echo elgg_view('object/plugin/invalid', $vars);
21  return;
22 }
23 
24 echo elgg_view('object/plugin/full', $vars);
Plugin class containing helper functions for plugin activation/deactivation, dependency checking capa...
Definition: ElggPlugin.php:17
elgg_in_context(string $context)
Check if this context exists anywhere in the stack.
Definition: context.php:78
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
$plugin
Used to show plugin user settings.
Definition: plugin.php:6
$vars
Definition: theme.php:5