You are here

function query_parameters_to_url_is_called_from_menu_item_edit in Query Parameters To URL 7

Checks if the function is called from inside menu item edit admin callback.

Necessary to be able to store rewritten urls in menu items.

1 call to query_parameters_to_url_is_called_from_menu_item_edit()
query_parameters_to_url_url_inbound_alter in ./query_parameters_to_url.module
Implements hook_url_inbound_alter().

File

./query_parameters_to_url.module, line 236
Query Arguments To URL module.

Code

function query_parameters_to_url_is_called_from_menu_item_edit() {
  $do_check = query_parameters_to_url_allow_rewritten_menu_item_save();
  if (!$do_check) {
    return FALSE;
  }
  $called = NULL;
  if (!isset($called)) {
    $called = FALSE;

    // Save memory in the debug_backtrace() function when possible.
    $options = version_compare(PHP_VERSION, '5.3.6', '>=') ? DEBUG_BACKTRACE_IGNORE_ARGS : NULL;
    $call_stack = debug_backtrace($options);

    // Check whether the function is called from inside menu item edit.
    foreach ($call_stack as $function) {
      $functions = array(
        'menu_edit_item_validate',
        'i18n_prepare_normal_path',
      );
      $called = in_array($function['function'], $functions);
      if ($called) {
        break;
      }
    }
  }
  return $called;
}