diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 89d489120b..8ab3d18a27 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -12,6 +12,7 @@ use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Render\Element; +use Drupal\system\Entity\Menu; /** * Prepares variables for single local task link templates. @@ -80,8 +81,14 @@ function template_preprocess_menu_local_action(&$variables) { /** * Returns an array containing the names of system-defined (default) menus. + * + * @deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use + * \Drupal\system\Entity\Menu::loadMultiple() instead. + * + * @see https://www.drupal.org/node/1882552 */ function menu_list_system_menus() { + @trigger_error(__FUNCTION__ . '() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\system\Entity\Menu::loadMultiple() instead. See https://www.drupal.org/node/1882552', E_USER_DEPRECATED); return [ 'tools' => 'Tools', 'admin' => 'Administration', diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module index a83dd825e3..14c2fb5241 100644 --- a/core/modules/menu_ui/menu_ui.module +++ b/core/modules/menu_ui/menu_ui.module @@ -442,7 +442,8 @@ function menu_ui_form_node_type_form_builder($entity_type, NodeTypeInterface $ty function menu_ui_get_menus($all = TRUE) { if ($custom_menus = Menu::loadMultiple()) { if (!$all) { - $custom_menus = array_diff_key($custom_menus, menu_list_system_menus()); + $menus = ['tools', 'admin', 'account', 'main', 'footer']; + $custom_menus = array_diff_key($custom_menus, array_combine($menus, $menus)); } foreach ($custom_menus as $menu_name => $menu) { $custom_menus[$menu_name] = $menu->label(); diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php index ea9cf95f98..074f1aa554 100644 --- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php +++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php @@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityTypeBundleInfoInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\UrlGeneratorTrait; +use Drupal\system\Entity\Menu; use Drupal\views\Entity\View; use Drupal\views\Views; use Drupal\views_ui\ViewUI; @@ -307,16 +308,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#prefix' => '', ]; - if (\Drupal::moduleHandler()->moduleExists('menu_ui')) { - $menu_options = menu_ui_get_menus(); - } - else { - // These are not yet translated. - $menu_options = menu_list_system_menus(); - foreach ($menu_options as $name => $title) { - $menu_options[$name] = $this->t($title); - } - } + $menu_options = Menu::loadMultiple(); + asort($menu_options); $form['displays']['page']['options']['link_properties']['menu_name'] = [ '#title' => $this->t('Menu'), '#type' => 'select',