function fp_build_tab_array

6.x theme.inc fp_build_tab_array($page)
4.x theme.inc fp_build_tab_array($page)
5.x theme.inc fp_build_tab_array($page)

Looks at the current page array and returns a valid $tab_array Meant for the top of the screen.

1 call to fp_build_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 398

Code

function fp_build_tab_array($page) {
  global $current_student_id;
  $tab_array = array();

  $tab_family = $page ["router_item"]["tab_family"];
  $active_tab_path = $page ["path"];

  if ($page ["router_item"]["tab_parent"] != "") {
    // We want to know the PARENT's tab_family, so we can display the correct tabs at the top of the page.
    $tab_parent = $page ["router_item"]["tab_parent"];

    $item = menu_get_item($tab_parent);
    $tab_family = $item ["tab_family"];
    $active_tab_path = $item ["path"];

  }


  // look for other possible tabs, based on the "tab_family" value 
  // Also check to make sure the user has access to the tab.   
  $items = menu_get_items_in_tab_family($tab_family);
  foreach ($items as $item) {

    // Does the user have access to this tab?
    if (!menu_check_user_access($item)) {
      continue;
    }

    $title = $item ["title"];
    $path = $item ["path"];
    $active = FALSE;
    $on_click = $page ["page_settings"]["tab_on_click"];
    if ($on_click == "") {
      // Just a simple link to the path
      // Include the current_student_id!
      $query = "&current_student_id=$current_student_id";

      $on_click = "window.location=\"" . base_path() . "/" . $path . $query . "\"";
    }

    if ($path == $active_tab_path) {
      // This is the current page we are on.
      $active = TRUE;
      $title = $page ["title"];
      $on_click = "";
    }

    $tab_array [] = array(
      "title" => $item ["title"],
      "active" => $active,
      "on_click" => $on_click,
    );

  }

  return $tab_array;
}