You are here

function _menu_position_menu_link_update in Menu Position 7.2

Same name and namespace in other branches
  1. 7 menu_position.admin.inc \_menu_position_menu_link_update()

Implements hook_menu_link_update().

1 call to _menu_position_menu_link_update()
menu_position_menu_link_update in ./menu_position.module
Implements hook_menu_link_update().

File

./menu_position.admin.inc, line 99
Provides infrequently used functions and hooks for menu_position.

Code

function _menu_position_menu_link_update($link) {
  $rules = db_query('SELECT rid, plid FROM {menu_position_rules} WHERE mlid = :mlid ORDER BY weight, rid', array(
    ':mlid' => $link['mlid'],
  ));
  foreach ($rules as $rule) {

    // Check if the user has altered the parent menu item.
    if ($link['plid'] != $rule->plid) {

      // Update the rule with the new parent.
      db_update('menu_position_rules')
        ->fields(array(
        'menu_name' => $link['menu_name'],
        'plid' => $link['plid'],
      ))
        ->condition('rid', $rule->rid)
        ->execute();
    }
  }
}