Elgg  Version 3.0
default_widgets.php
Go to the documentation of this file.
1 <?php
9 elgg_push_context('default_widgets');
10 $widget_context = get_input('widget_context');
11 $list = elgg_trigger_plugin_hook('get_list', 'default_widgets', null, []);
12 
13 // default to something if we can
14 if (!$widget_context && $list) {
15  $widget_context = $list[0]['widget_context'];
16 }
17 
19 $tabs = [];
20 foreach ($list as $info) {
21  $selected = false;
22  if ($widget_context == $info['widget_context']) {
23  $selected = true;
25  }
26 
27  $tabs[] = [
28  'text' => $info['name'],
29  'href' => "admin/configure_utilities/default_widgets?widget_context={$info['widget_context']}",
30  'selected' => $selected,
31  ];
32 }
33 
35  'tabs' => $tabs
36 ];
37 
38 echo elgg_view('navigation/tabs', $tabs_vars);
39 
40 echo elgg_view('output/longtext', ['value' => elgg_echo('admin:default_widgets:instructions')]);
41 
42 if (!$current_info) {
43  $content = elgg_echo('admin:default_widgets:unknown_type');
44 } else {
45  // default widgets are owned and saved to the site.
47  elgg_push_context($current_info['widget_context']);
48 
49  $content = elgg_view_layout('widgets', [
50  'num_columns' => $current_info['widget_columns'],
51  ]);
53 }
55 
foreach($list as $info) $tabs_vars
$content
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:81
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_pop_context()
Removes and returns the top context string from the stack.
Definition: pageowner.php:222
elgg echo
Translates a string.
Definition: languages.js:43
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Definition: elgglib.php:720
if(!$widget_context &&$list) $current_info
if(!empty($screenshots)) $info
Definition: details.php:59
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:212
elgg_view_layout($layout_name, $vars=[])
Displays a layout with optional parameters.
Definition: views.php:593
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246
$widget_context