1.20.x menu.install menu_update_1000()

Moves menu settings from variables to config.

Related topics

File

modules/menu/menu.install, line 56
Install, update and uninstall functions for the menu module.

Code

function menu_update_1000() {
  // Migrate variables to config.
  $config = config('menu.settings');
  $config->set('menu_main_links', update_variable_get('menu_main_links_source', 'main-menu'));
  $config->set('menu_secondary_links_source', update_variable_get('menu_main_links_source', 'user-menu'));
  $config->save();

  // Delete variables.
  update_variable_del('menu_main_links_source');
  update_variable_del('menu_secondary_links_source');
}