Elgg  Version 3.0
section.php
Go to the documentation of this file.
1 <?php
13 $items = elgg_extract('items', $vars, []);
14 if (empty($items) || !is_array($items)) {
15  return;
16 }
17 unset($vars['items']);
18 
19 $headers = elgg_extract('show_section_headers', $vars, false);
20 unset($vars['show_section_headers']);
21 
22 $item_class = elgg_extract('item_class', $vars, '');
23 unset($vars['item_class']);
24 
26 unset($vars['name']);
27 
28 $section = elgg_extract('section', $vars);
29 unset($vars['section']);
30 $vars['data-menu-section'] = $section;
31 
32 if ($headers) {
34  'class' => 'elgg-menu-section-header',
35  ], elgg_echo("menu:$name:header:$section"));
36 }
37 
38 $lis = [];
39 foreach ($items as $menu_item) {
40  $lis[] = elgg_view('navigation/menu/elements/item', [
41  'item' => $menu_item,
42  'item_class' => $item_class,
43  ]);
44 }
45 
46 echo elgg_format_element('ul', $vars, implode(PHP_EOL, $lis));
elgg_echo($message_key, array $args=[], $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_format_element($tag_name, array $attributes=[], $text= '', array $options=[])
Format an HTML element.
Definition: output.php:168
elgg echo
Translates a string.
Definition: languages.js:43
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1131
elgg_view($view, $vars=[], $viewtype= '')
Return a parsed view.
Definition: views.php:246