Elgg  Version 3.0
tabs.php
Go to the documentation of this file.
1 <?php
11 if (empty($tabs) || !is_array($tabs)) {
12  return;
13 }
14 unset($vars['tabs']);
15 
16 // make sure tabs have a name (for menu item rendering)
17 foreach ($tabs as $index => &$tab) {
18  if (isset($tab['name'])) {
19  continue;
20  }
21 
22  // BC tab params
23  if (!isset($tab['text']) && isset($tab['title'])) {
24  elgg_deprecated_notice("Passing 'title' instead of 'text' to the navigation/tabs tab is deprecated. Use 'text' instead.", '3.0');
25 
26  $tab['text'] = $tab['title'];
27  unset($tab['title']);
28  }
29 
30  if (!isset($tab['href']) && isset($tab['url'])) {
31  elgg_deprecated_notice("Passing 'url' to the navigation/tabs tab is deprecated. Use 'href' instead.", '3.0');
32  $tab['href'] = $tab['url'];
33  unset($tab['url']);
34  }
35 
36  if (isset($tab['id']) && isset($tab['link_id'])) {
37  elgg_deprecated_notice("The navigation/tabs tab does not support passing 2 ids. Only 'id' is used to set the id of the menu item", '3.0');
38  }
39 
40  if (!isset($tab['id']) && isset($tab['link_id'])) {
41  elgg_deprecated_notice("Passing 'link_id' to the navigation/tabs tab is deprecated. Use 'id' instead.", '3.0');
42 
43  $tab['id'] = $tab['link_id'];
44  unset($tab['link_id']);
45  }
46 
47  if (!isset($tab['item_class']) && isset($tab['class'])) {
48  elgg_deprecated_notice("Passing 'class' to the navigation/tabs tab is deprecated. Use 'item_class' instead.", '3.0');
49 
50  $tab['item_class'] = $tab['class'];
51  unset($tab['class']);
52  }
53 
54  $tab['name'] = "tab-{$index}";
55 }
56 
58 
59 $type = elgg_extract('type', $vars, 'horizontal');
60 unset($options['type']);
61 
62 $class = [
63  'elgg-tabs',
64 ];
65 if ($type == 'horizontal') {
66  $class[] = 'elgg-htabs';
67 } else {
68  $class[] = 'elgg-vtabs';
69 }
70 
72 $options['items'] = $tabs;
73 
74 echo elgg_view_menu('navigation/tabs', $options);
elgg_extract_class(array $array, $existing=[], $extract_key= 'class')
Extract class names from an array, optionally merging into a preexisting set.
Definition: elgglib.php:1153
elgg_view_menu($menu, array $vars=[])
Render a menu.
Definition: views.php:755
elgg echo
Translates a string.
Definition: languages.js:43
elgg_deprecated_notice($msg, $dep_version, $backtrace_level=1)
Log a notice about deprecated use of a function, view, etc.
Definition: elgglib.php:841
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
$index
Definition: gallery.php:47
if(!isset($vars['id'])) $vars['id']
Definition: tabs.php:37