function og_menu_node_delete in Organic Groups Menu (OG Menu) 7.3
Same name and namespace in other branches
- 7.2 og_menu.module \og_menu_node_delete()
Implements hook_node_delete().
File
- ./
og_menu.module, line 849 - Integrates Menu with Organic Groups. Lots of menu forms duplication in OG context.
Code
function og_menu_node_delete($node) {
if (og_is_group_type('node', $node->type)) {
/* We need to be careful here. As users can create menu of whatever name,
* we can't just delete from menu_custom looking for 'menu-og-' . [gid]
* we need the gid of the group being deleted, see if its an og associated
* menu from og_menu and then from that menu name, delete it.
*/
$result = db_select('og_menu', 'm')
->fields('m', array(
'menu_name',
))
->condition('gid', $node->nid, '=')
->condition('group_type', 'node', '=')
->execute();
while ($record = $result
->fetchAssoc()) {
$menu = menu_load($record['menu_name']);
menu_delete($menu);
og_menu_delete_menu($record['menu_name']);
}
}
}