function menu_link_children_relative_depth

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 menu.inc menu_link_children_relative_depth($item)
cle7 menu.inc menu_link_children_relative_depth($item)
elmsmedia7 menu.inc menu_link_children_relative_depth($item)
icor7 menu.inc menu_link_children_relative_depth($item)
meedjum_blog7 menu.inc menu_link_children_relative_depth($item)
mooc7 menu.inc menu_link_children_relative_depth($item)

Finds the depth of an item's children relative to its depth.

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.

Parameters

$item: An array representing a menu link item.

Return value

The relative depth, or zero.

Related topics

3 calls to menu_link_children_relative_depth()
menu_link_save in includes/menu.inc
Saves a menu link.
_book_parent_depth_limit in modules/book/book.module
Finds 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.

File

includes/menu.inc, line 3432
API for the Drupal menu system.

Code

function menu_link_children_relative_depth($item) {
  $query = db_select('menu_links');
  $query->addField('menu_links', 'depth');
  $query->condition('menu_name', $item['menu_name']);
  $query->orderBy('depth', 'DESC');
  $query->range(0, 1);

  $i = 1;
  $p = 'p1';
  while ($i <= MENU_MAX_DEPTH && $item[$p]) {
    $query->condition($p, $item[$p]);
    $p = 'p' . ++$i;
  }

  $max_depth = $query->execute()->fetchField();

  return ($max_depth > $item['depth']) ? $max_depth - $item['depth'] : 0;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.