You are here

function menu_block_update_6200 in Menu Block 7.2

Same name and namespace in other branches
  1. 6.2 menu_block.install \menu_block_update_6200()
  2. 7.3 menu_block.install \menu_block_update_6200()

Converts to Drupal 6 menu names.

File

./menu_block.install, line 110
Provides install, upgrade and un-install functions for menu_block.

Code

function menu_block_update_6200() {
  $menus = menu_get_menus();
  foreach (variable_get('menu_block_ids', array()) as $delta) {

    // Drupal 6 uses the menu title to create the new menu_name.
    $menu_name = preg_replace('/[^a-zA-Z0-9]/', '-', strtolower(variable_get("menu_block_{$delta}_title", '')));

    // If we can't find the new menu_name, default to the navigation menu.
    if (empty($menus[$menu_name])) {
      $menu_name = 'navigation';
    }
    variable_set("menu_block_{$delta}_menu_name", $menu_name);
    variable_del("menu_block_{$delta}_title");
  }
  return t('The 5.x-2.x version of Menu block has been upgraded to the 6.x-2.0 data storage format.');
}