You are here

function menu_block_update_7200 in Menu Block 7.2

Same name and namespace in other branches
  1. 7.3 menu_block.install \menu_block_update_7200()

Converts to Drupal 7 menu names.

File

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

Code

function menu_block_update_7200() {
  foreach (variable_get('menu_block_ids', array()) as $delta) {
    $menu_name = '';
    list($old_menu_name, $parent_mlid) = explode(':', variable_get("menu_block_{$delta}_parent", ' : '));
    switch ($old_menu_name) {
      case 'primary-links':
        $menu_name = 'main-menu';
        break;
      case 'secondary-links':
        $menu_name = 'secondary-menu';
        break;
      case 'navigation':
        $menu_name = 'management';
        break;
    }
    if ($menu_name) {
      variable_set("menu_block_{$delta}_parent", $menu_name . ':' . $parent_mlid);
    }
  }
  return t('The 6.x-2.x version of Menu block has been upgraded to use the new menu names in Drupal 7. To use menu blocks in Drupal 7, find the "Add menu block" link on the <a href="@url">administer blocks page</a>.', array(
    '@url' => url('admin/structure/block'),
  ));
}