You are here

function menu_item_container_enable in Menu item container 6

Same name and namespace in other branches
  1. 7 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 "%%s:22:\\"menu_item_container_id\\";%%"');
  while ($row = db_fetch_array($result)) {

    // 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_query('UPDATE {menu_links} SET module = "menu_item_container", link_path = "%s", router_path = "menu-item-container", external = 0, options = "%s" WHERE mlid = %d', $link_path, serialize($options), $row['mlid']);
  }
}