Elgg  Version 5.1
tabs.php
Go to the documentation of this file.
1 <?php
11 if (empty($tabs) || !is_array($tabs)) {
12  return;
13 }
14 
15 unset($vars['tabs']);
16 
17 // make sure tabs have a name (for menu item rendering)
18 foreach ($tabs as $index => &$tab) {
19  if (isset($tab['name'])) {
20  continue;
21  }
22 
23  $tab['name'] = "tab-{$index}";
24 }
25 
27 
28 $type = elgg_extract('type', $vars, 'horizontal');
29 unset($options['type']);
30 
31 $class = [
32  'elgg-tabs',
33 ];
34 if ($type == 'horizontal') {
35  $class[] = 'elgg-htabs';
36 } else {
37  $class[] = 'elgg-vtabs';
38 }
39 
41 $options['items'] = $tabs;
42 
43 echo elgg_view_menu('navigation/tabs', $options);
$tabs
Definition: tabs.php:10
elgg_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:276
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_menu($menu, array $vars=[])
Render a menu.
Definition: views.php:462
if(!isset($id)) $vars['id']
Definition: tabs.php:38
$index
Definition: gallery.php:40