_menu_item_is_accessible

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/menu.inc, строка 1153

Версии
5
_menu_item_is_accessible($mid)

Determine whether the given menu item is accessible to the current user.

Use this instead of just checking the 'access' property of a menu item to properly handle items with fall-through semantics.

▾ 7 функции вызывают _menu_item_is_accessible()

menu_execute_active_handler in includes/menu.inc
Запускает обработчик связанный с активизированным пунктом меню.
menu_get_active_help in includes/menu.inc
Возвращает справку связанную с активизированным пунктом меню.
system_admin_menu_block in modules/system/system.module
Создает простой блок на странице администрирования.
system_get_module_admin_tasks in modules/system/system.module
_menu_append_contextual_items in includes/menu.inc
Account for menu items that are only defined at certain paths, so will not be cached.
_menu_build_local_tasks in includes/menu.inc
Find all the items in the current local task tree.
_menu_build_visible_tree in includes/menu.inc
Find all visible items in the menu tree, for ease in displaying to user.

Код

<?php
function _menu_item_is_accessible($mid) {
  $menu = menu_get_menu();

  // Follow the path up to find the first "access" attribute.
  $path = isset($menu['items'][$mid]['path']) ? $menu['items'][$mid]['path'] : NULL;
  while ($path && (!isset($menu['path index'][$path]) || !isset($menu['items'][$menu['path index'][$path]]['access']))) {
    $path = substr($path, 0, strrpos($path, '/'));
  }
  if (empty($path)) {
    // Items without any access attribute up the chain are denied, unless they
    // were created by the admin. They most likely point to non-Drupal directories
    // or to an external URL and should be allowed.
    return $menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN;
  }
  return $menu['items'][$menu['path index'][$path]]['access'];
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему