function _menu_link_move_children


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/
cis7 _menu_link_move_children($item, $existing_item)
cle7 _menu_link_move_children($item, $existing_item)
elmsmedia7 _menu_link_move_children($item, $existing_item)
icor7 _menu_link_move_children($item, $existing_item)
meedjum_blog7 _menu_link_move_children($item, $existing_item)
mooc7 _menu_link_move_children($item, $existing_item)

Updates the children of a menu link that is being moved.

The menu name, parents (p1 - p6), and depth are updated for all children of the link, and the has_children status of the previous parent is updated.

Related topics

1 call to _menu_link_move_children()
menu_link_save in includes/
Saves a menu link.


includes/, line 3457
API for the Drupal menu system.


function _menu_link_move_children($item, $existing_item) {
  $query = db_update('menu_links');

  $query->fields(array('menu_name' => $item['menu_name']));

  $p = 'p1';
  $expressions = array();
  for ($i = 1; $i <= $item['depth']; $p = 'p' . ++$i) {
    $expressions[] = array($p, ":p_$i", array(":p_$i" => $item[$p]));
  $j = $existing_item['depth'] + 1;
  while ($i <= MENU_MAX_DEPTH && $j <= MENU_MAX_DEPTH) {
    $expressions[] = array('p' . $i++, 'p' . $j++, array());
  while ($i <= MENU_MAX_DEPTH) {
    $expressions[] = array('p' . $i++, 0, array());

  $shift = $item['depth'] - $existing_item['depth'];
  if ($shift > 0) {
    // The order of expressions must be reversed so the new values don't
    // overwrite the old ones before they can be used because "Single-table
    // UPDATE assignments are generally evaluated from left to right"
    // see:
    $expressions = array_reverse($expressions);
  foreach ($expressions as $expression) {
    $query->expression($expression[0], $expression[1], $expression[2]);

  $query->expression('depth', 'depth + :depth', array(':depth' => $shift));
  $query->condition('menu_name', $existing_item['menu_name']);
  $p = 'p1';
  for ($i = 1; $i <= MENU_MAX_DEPTH && $existing_item[$p]; $p = 'p' . ++$i) {
    $query->condition($p, $existing_item[$p]);


  // Check the has_children status of the parent, while excluding this item.
  _menu_update_parental_status($existing_item, TRUE);



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.