| 6 menu.inc | _menu_update_parental_status($item, $exclude = FALSE) |
| 7 menu.inc | _menu_update_parental_status($item, $exclude = FALSE) |
| 8 menu.inc | _menu_update_parental_status($item, $exclude = FALSE) |
Check and update the has_children status for the parent of a link.
Related topics
3 calls to _menu_update_parental_status()
File
- includes/
menu.inc, line 2243 - API for the Drupal menu system.
Code
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