_menu_update_parental_status
- Versions
- 6 – 7
_menu_update_parental_status($item, $exclude = FALSE)
Check and update the has_children status for the parent of a link.
Related topics
Code
includes/menu.inc, line 2224
<?php
function _menu_update_parental_status($item, $exclude = FALSE) {
// If plid == 0, there is nothing to update.
if ($item['plid']) {
// We may want to exclude the passed link as a possible child.
$where = $exclude ? " AND mlid != %d" : '';
// Check if at least one visible child exists in the table.
$parent_has_children = (bool)db_result(db_query_range("SELECT mlid FROM {menu_links} WHERE menu_name = '%s' AND plid = %d AND hidden = 0". $where, $item['menu_name'], $item['plid'], $item['mlid'], 0, 1));
db_query("UPDATE {menu_links} SET has_children = %d WHERE mlid = %d", $parent_has_children, $item['plid']);
}
}
?>Login or register to post comments 