menu_link_children_relative_depth

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

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

Версии
6
menu_link_children_relative_depth($item)

Находит глубину потомков пункта по отношению к глубине пункта.

For example, if the item has a depth of 2, and the maximum of any child in the menu link tree is 5, the relative depth is 3.

Параметры

$item An array representing a menu link item.

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

The relative depth, or zero.

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

▾ 3 функции вызывают menu_link_children_relative_depth()

menu_link_save in includes/menu.inc
Сохраняет ссылку меню.
_book_parent_depth_limit in modules/book/book.module
Find the depth limit for items in the parent select.
_menu_parent_depth_limit in modules/menu/menu.module
Find the depth limit for items in the parent select.

Код

<?php
function menu_link_children_relative_depth($item) {
  $i = 1;
  $match = '';
  $args[] = $item['menu_name'];
  $p = 'p1';
  while ($i <= MENU_MAX_DEPTH && $item[$p]) {
    $match .= " AND $p = %d";
    $args[] = $item[$p];
    $p = 'p'. ++$i;
  }

  $max_depth = db_result(db_query_range("SELECT depth FROM {menu_links} WHERE menu_name = '%s'". $match ." ORDER BY depth DESC", $args, 0, 1));

  return ($max_depth > $item['depth']) ? $max_depth - $item['depth'] : 0;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

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