You are here

function token_menu_get_mid in Token 5

Check if mid/path is present in the menu.

Parameters

$in: Numeric input is treated as a menu-id, strings as src-paths.

Return value

An existing mid, or 0 if none found.

1 call to token_menu_get_mid()
node_token_values in ./token_node.inc
Implementation of hook_token_values().

File

./token_node.inc, line 279
Implementations of token module hooks for the core node and book modules.

Code

function token_menu_get_mid($in) {
  global $_menu;
  if (!is_numeric($in)) {
    if (isset($_menu['path index'][$in])) {
      $mid = $_menu['path index'][$in];
    }
    else {
      $mid = 0;
    }
  }
  else {
    if (!isset($_menu['visible'][$in])) {
      $mid = 0;
    }
  }

  // Temporary paths would break much of this module.
  if ($mid < 0) {
    $mid = 0;
  }
  return $mid;
}