You are here

function _menu_token_is_called_from_features in Menu Token 7

Returns TRUE if 'menu_links_features_export_render' is in the callstack.

1 call to _menu_token_is_called_from_features()
menu_token_translated_menu_link_alter in ./menu_token.module
Implements hook_translated_menu_link_alter().

File

./menu_token.module, line 255
Main module file for the Menu Token module.

Code

function _menu_token_is_called_from_features() {
  $called =& drupal_static(__FUNCTION__);
  if (!isset($called)) {
    if (module_exists('features')) {

      // Save memory in the debug_backtrace() function when possible
      if (version_compare(PHP_VERSION, '5.3.6', '>=')) {
        $callstack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
      }
      else {
        $callstack = debug_backtrace();
      }
      foreach ($callstack as $function) {
        $called = $function['function'] == 'menu_links_features_export_render';
        if ($called) {
          break;
        }
      }
    }
    else {
      $called = FALSE;
    }
  }
  return $called;
}