Elgg  Version master
default_widgets.php
Go to the documentation of this file.
1 <?php
6 elgg_push_context('default_widgets');
7 $widget_context = get_input('widget_context');
8 $list = elgg_trigger_event_results('get_list', 'default_widgets', [], []);
9 
10 // default to something if we can
11 if (!$widget_context && $list) {
12  $widget_context = $list[0]['widget_context'];
13 }
14 
16 $tabs = [];
17 foreach ($list as $info) {
18  $selected = false;
19  if ($widget_context == $info['widget_context']) {
20  $selected = true;
22  }
23 
24  $tabs[] = [
25  'text' => $info['name'],
26  'href' => "admin/configure_utilities/default_widgets?widget_context={$info['widget_context']}",
27  'selected' => $selected,
28  ];
29 }
30 
32  'tabs' => $tabs
33 ];
34 
35 echo elgg_view('navigation/tabs', $tabs_vars);
36 
37 echo elgg_view('output/longtext', ['value' => elgg_echo('admin:default_widgets:instructions')]);
38 
39 if (!$current_info) {
40  $content = elgg_echo('admin:default_widgets:unknown_type');
41 } else {
42  // default widgets are owned and saved to the site.
44  elgg_push_context($current_info['widget_context']);
45 
46  $content = elgg_view_layout('widgets', [
47  'num_columns' => $current_info['widget_columns'],
48  ]);
50 }
51 
53 
54 echo $content;
elgg_view_layout(string $layout_name, array $vars=[])
Displays a layout with optional parameters.
Definition: views.php:352
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
foreach($list as $info) $tabs_vars
$content
elgg_trigger_event_results(string $event, string $type, array $params=[], $returnvalue=null)
Triggers an event where it is expected that the mixed return value could be manipulated by event call...
Definition: events.php:117
elgg_set_page_owner_guid(int $guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:34
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_pop_context()
Removes and returns the top context string from the stack.
Definition: context.php:62
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
if(!$widget_context &&$list) $current_info
$selected
Admin helper view for tabs on the different security pages.
Definition: tabs.php:8
elgg_push_context(string $context)
Push a context onto the top of the stack.
Definition: context.php:52
$widget_context