function admin_menu_link_save in Administration menu 6
Convenience function that looks up the plid if $item['parent_path'] is set.
1 call to admin_menu_link_save()
- _admin_menu_rebuild_links in ./
admin_menu.inc - The key function that builds the menu links whenever there is a menu rebuild.
File
- ./
admin_menu.inc, line 88
Code
function admin_menu_link_save($item) {
$item = admin_menu_link_build($item);
// Check whether we are able to update an existing item.
$existing_item = db_fetch_array(db_query("SELECT mlid, plid, has_children FROM {menu_links} WHERE link_path = '%s' AND menu_name = '%s'", $item['link_path'], 'admin_menu'));
if ($existing_item) {
$item['mlid'] = $existing_item['mlid'];
$item['plid'] = $existing_item['plid'];
$item['has_children'] = $existing_item['has_children'];
}
// Look up the parent path for both new and existing links, since the parent
// may change.
if (isset($item['parent_path'])) {
if ($item['parent_path'] == '<root>') {
// <root> means that we want the link at the top level.
$item['plid'] = 0;
}
else {
$plid = db_result(db_query("SELECT mlid from {menu_links} WHERE link_path = '%s' AND menu_name = '%s'", $item['parent_path'], 'admin_menu'));
if ($plid) {
$item['plid'] = $plid;
}
}
}
menu_link_save($item);
}