You are here

function _menu_position_menu_link_alter in Menu Position 6

Implements hook_menu_link_alter().

1 call to _menu_position_menu_link_alter()
menu_position_menu_link_alter in ./menu_position.module
Implements hook_menu_link_alter().

File

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

Code

function _menu_position_menu_link_alter(&$link, $menu) {

  // Don't allow the link to be "enabled".
  $link['hidden'] = 1;
  $rules = db_query('SELECT rid, plid FROM {menu_position_rules} WHERE mlid = %d ORDER BY weight, rid', $link['mlid']);
  while ($rule = db_fetch_object($rules)) {

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

      // Update the rule with the new parent.
      db_query('UPDATE {menu_position_rules} SET menu_name = "%s", plid = %d WHERE rid = %d', array(
        $link['menu_name'],
        $link['plid'],
        $rule->rid,
      ));
    }
  }
}