function fp_render_tab_array
Search API
7.x theme.inc | fp_render_tab_array($tab_array) |
6.x theme.inc | fp_render_tab_array($tab_array) |
4.x theme.inc | fp_render_tab_array($tab_array) |
5.x theme.inc | fp_render_tab_array($tab_array) |
Given a propperly formatted tab_array, this will return the HTML to draw it on a page.
Parameters
array $tab_array:
- Array should have this structure:
- $tab_array[i]["title"] = The title or caption of the tab. "main", or "Edit", etc.
- $tab_array[i]["active"] = boolean. True if this is the tab we are currently looking at.
- $tab_array[i]["href"] = This is a complete href for the link we will create.
- $tab_array[i]["on_click"] = This is an onClick command for javascript. If this is set, href will be ignored.
Return value
string
1 call to fp_render_tab_array()
- fp_display_page in includes/
theme.inc - Output the contents of the $page variable to the screen. $page is an array containing details about the page, as well as its original menu item (router_item) definition.
File
- includes/
theme.inc, line 1997
Code
function fp_render_tab_array($tab_array) {
$rtn = "";
if (count($tab_array) == 0) {
return "";
}
$img_path = fp_theme_location() . "/images";
$rtn .= "<ul class='tabs'>";
for ($t = 0; $t < count($tab_array); $t++)
{
$title = @$tab_array [$t]["title"];
// If the title has a replacement pattern in it, then we need to call a hook to see what it should be set to.
if (strpos($title, "%") !== 0) {
$title = menu_convert_replacement_pattern($title);
}
$active = @$tab_array [$t]["active"];
$on_click = @$tab_array [$t]["on_click"];
$href = @$tab_array [$t]["href"];
$extra_a = "";
if ($on_click != "") {
$href = "javascript:void(0);";
$extra_a = "onclick='$on_click'";
}
if ($title == "")
{
continue;
}
$extra_class = "inactive";
if ($active) {
$extra_class = "active";
// the active tab is not clickable.
$href = 'javascript:void(0);';
$extra_a = '';
}
if ($t == 0) {
$extra_class .= " first";
}
if ($t == count($tab_array) - 1) {
$extra_class .= " last";
}
// Also add in a machine-friendly class based on the title and position
$extra_class .= " tab-count-$t tab-title-" . fp_get_machine_readable(strtolower(trim($title)));
$rtn .= "<li class='tab $extra_class'><a href='$href' $extra_a>$title</a></li>";
}
$rtn .= "</ul>";
return $rtn;
}