From 8c73e5da141ea76f10973936267aa726d8892ad3 Mon Sep 17 00:00:00 2001 From: Ismayil Khayredinov Date: Fri, 23 Dec 2011 16:19:23 +0100 Subject: fixes for tab rendering --- views/default/navigation/tabs.php | 92 ++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 41 deletions(-) (limited to 'views/default/navigation') diff --git a/views/default/navigation/tabs.php b/views/default/navigation/tabs.php index e8fde3579..219646c64 100644 --- a/views/default/navigation/tabs.php +++ b/views/default/navigation/tabs.php @@ -5,8 +5,8 @@ * @uses string $vars['type'] horizontal || vertical - Defaults to horizontal * @uses string $vars['class'] Additional class to add to ul * @uses array $vars['tabs'] A multi-dimensional array of tab entries in the format array( - * 'title' => string, // Title of link - * 'url' => string, // URL for the link + * 'text' => string, // Title of link + * 'href' => string, // URL for the link * 'class' => string // Class of the li element * 'id' => string, // ID of the li element * 'selected' => bool // if this li element is currently selected @@ -15,58 +15,68 @@ * ) */ +$options = elgg_clean_vars($vars); + $type = elgg_extract('type', $vars, 'horizontal'); + if ($type == 'horizontal') { - $type_class = "elgg-tabs elgg-htabs"; + $options['class'] = "elgg-tabs elgg-htabs"; } else { - $type_class = "elgg-tabs elgg-vtabs"; + $options['class'] = "elgg-tabs elgg-vtabs"; } - if (isset($vars['class'])) { - $type_class = "$type_class {$vars['class']}"; + $options['class'] = "{$options['class']} {$vars['class']}"; } +unset($options['tabs']); +unset($options['type']); + +$options = elgg_format_attributes($options); + if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) { -?> - +