You are here

function globallink_menu_count_parents in GlobalLink Connect for Drupal 7.5

Same name and namespace in other branches
  1. 7.7 globallink_menu/globallink_menu.inc \globallink_menu_count_parents()
  2. 7.6 globallink_menu/globallink_menu.inc \globallink_menu_count_parents()

Counts parents of menu link.

Parameters

string $menu_link: The menu link.

Return value

int The number of parents of the menu link.

1 call to globallink_menu_count_parents()
globallink_menu_sort_gl_objects_by_menu_order in globallink_menu/globallink_menu.inc
Sorts GlobalLink objects by menu order.

File

globallink_menu/globallink_menu.inc, line 453

Code

function globallink_menu_count_parents($menu_link) {
  $count = 0;
  if (isset($menu_link)) {
    if (isset($menu_link['p1']) && $menu_link['p1'] != 0) {
      $count++;
    }
    if (isset($menu_link['p2']) && $menu_link['p2'] != 0) {
      $count++;
    }
    if (isset($menu_link['p3']) && $menu_link['p3'] != 0) {
      $count++;
    }
    if (isset($menu_link['p4']) && $menu_link['p4'] != 0) {
      $count++;
    }
    if (isset($menu_link['p5']) && $menu_link['p5'] != 0) {
      $count++;
    }
    if (isset($menu_link['p6']) && $menu_link['p6'] != 0) {
      $count++;
    }
    if (isset($menu_link['p7']) && $menu_link['p7'] != 0) {
      $count++;
    }
    if (isset($menu_link['p8']) && $menu_link['p8'] != 0) {
      $count++;
    }
    if (isset($menu_link['p9']) && $menu_link['p9'] != 0) {
      $count++;
    }
  }
  return $count;
}