function menu_item_container_enable in Menu item container 7
Same name and namespace in other branches
- 6 menu_item_container.install \menu_item_container_enable()
Implements hook_enable().
File
- ./
menu_item_container.install, line 10 - Provides enable/disable functions for menu item containers.
Code
function menu_item_container_enable() {
$result = db_query('SELECT mlid, options FROM {menu_links} WHERE options LIKE :option', array(
':option' => '%s:22:"menu_item_container_id";%',
));
foreach ($result as $row) {
// Retrieve the container ID.
$options = unserialize($row->options);
$link_path = 'menu-item-container/' . $options['menu_item_container_id'];
unset($options['menu_item_container_id']);
// Update the module, link_path, router_path, and external attributes.
db_update('menu_links')
->fields(array(
'module' => 'menu_item_container',
'link_path' => $link_path,
'router_path' => 'menu-item-container',
'external' => 0,
'options' => serialize($options),
))
->condition('mlid', $row->mlid)
->execute();
}
}