_menu_link_translate

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

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

Версии
6
_menu_link_translate(&$item)

This function is similar to _menu_translate() but does link-specific preparation such as always calling to_arg functions.

Параметры

$item A menu link

Возвращаемое значение

Returns the map of path arguments with objects loaded as defined in the $item['load_functions']:

  • $item['access'] becomes TRUE if the item is accessible, FALSE otherwise.
  • $item['href'] is generated from link_path, possibly by to_arg functions.
  • $item['title'] is generated from link_title, and may be localized.
  • $item['options'] is unserialized; it is also changed within the call here to $item['localized_options'] by _menu_item_localize().

Связанные темы

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

book_link_load in modules/book/book.module
Like menu_link_load(), but adds additional data from the {book} table.
menu_link_load in includes/menu.inc
Возвращает элемент меню по его идентификатору (mlid), с проверкой доступа и переведенным заголовком и описанием. Такой элемент готов к рендерингу и выводу.
menu_valid_path in includes/menu.inc
Проверяет путь ссылки создаваемого или редактируемого пункта меню.
system_admin_menu_block in modules/system/system.module
Создает простой блок на странице администрирования.
system_get_module_admin_tasks in modules/system/system.module
Создаёт список задач предлагаемый указанным модулем.
system_main_admin_page in modules/system/system.admin.inc
Menu callback; Provide the administration overview page.
_menu_tree_check_access in includes/menu.inc
Recursive helper function for menu_tree_check_access()

Код

<?php
function _menu_link_translate(&$item) {
  $item['options'] = unserialize($item['options']);
  if ($item['external']) {
    $item['access'] = 1;
    $map = array();
    $item['href'] = $item['link_path'];
    $item['title'] = $item['link_title'];
    $item['localized_options'] = $item['options'];
  }
  else {
    $map = explode('/', $item['link_path']);
    _menu_link_map_translate($map, $item['to_arg_functions']);
    $item['href'] = implode('/', $map);

    // Note - skip callbacks without real values for their arguments.
    if (strpos($item['href'], '%') !== FALSE) {
      $item['access'] = FALSE;
      return FALSE;
    }
    // menu_tree_check_access() may set this ahead of time for links to nodes.
    if (!isset($item['access'])) {
      if (!_menu_load_objects($item, $map)) {
        // An error occurred loading an object.
        $item['access'] = FALSE;
        return FALSE;
      }
      _menu_check_access($item, $map);
    }
    // For performance, don't localize a link the user can't access.
    if ($item['access']) {
      _menu_item_localize($item, $map, TRUE);
    }
  }

  // Allow other customizations - e.g. adding a page-specific query string to the
  // options array. For performance reasons we only invoke this hook if the link
  // has the 'alter' flag set in the options array.
  if (!empty($item['options']['alter'])) {
    drupal_alter('translated_menu_link', $item, $map);
  }

  return $map;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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