1 menu.install menu_update_1002()

Move individual menus into config files.

Related topics

File

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

Code

function menu_update_1002() {
  if (!db_table_exists('menu_custom')) {
    return;
  }

  $menus = db_query("SELECT * FROM {menu_custom}")->fetchAllAssoc('menu_name');
  foreach ($menus as $menu) {
    $menu = (array) $menu;
    $config = config('menu.menu.' . $menu['menu_name']);
    $config->setData($menu);
    $config->save();
  }

  db_drop_table('menu_custom');
}