Issue #3260765 by andypost, quietone, xjm: Remove deprecated code from menu-related subsystems
							parent
							
								
									27158f7c9d
								
							
						
					
					
						commit
						c66f68bc8a
					
				| 
						 | 
				
			
			@ -1,34 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file
 | 
			
		||||
 * API for the Drupal menu system.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @addtogroup menu
 | 
			
		||||
 * @{
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Returns an array containing the names of system-defined (default) menus.
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
 | 
			
		||||
 *   \Drupal\system\Entity\Menu::loadMultiple() instead.
 | 
			
		||||
 *
 | 
			
		||||
 * @see https://www.drupal.org/node/3027453
 | 
			
		||||
 */
 | 
			
		||||
function menu_list_system_menus() {
 | 
			
		||||
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\system\Entity\Menu::loadMultiple() instead. See https://www.drupal.org/node/3027453', E_USER_DEPRECATED);
 | 
			
		||||
  return [
 | 
			
		||||
    'tools' => 'Tools',
 | 
			
		||||
    'admin' => 'Administration',
 | 
			
		||||
    'account' => 'User account menu',
 | 
			
		||||
    'main' => 'Main navigation',
 | 
			
		||||
    'footer' => 'Footer menu',
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @} End of "addtogroup menu".
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -2082,7 +2082,6 @@ function drupal_common_theme() {
 | 
			
		|||
    'pager' => [
 | 
			
		||||
      'render element' => 'pager',
 | 
			
		||||
    ],
 | 
			
		||||
    // From menu.inc.
 | 
			
		||||
    'menu' => [
 | 
			
		||||
      'variables' => ['menu_name' => NULL, 'items' => [], 'attributes' => []],
 | 
			
		||||
    ],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -537,7 +537,6 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
 | 
			
		|||
    require_once $this->root . '/core/includes/common.inc';
 | 
			
		||||
    require_once $this->root . '/core/includes/module.inc';
 | 
			
		||||
    require_once $this->root . '/core/includes/theme.inc';
 | 
			
		||||
    require_once $this->root . '/core/includes/menu.inc';
 | 
			
		||||
    require_once $this->root . '/core/includes/form.inc';
 | 
			
		||||
    require_once $this->root . '/core/includes/errors.inc';
 | 
			
		||||
    require_once $this->root . '/core/includes/schema.inc';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,9 +133,6 @@ interface BookManagerInterface {
 | 
			
		|||
  /**
 | 
			
		||||
   * Provides book loading, access control and translation.
 | 
			
		||||
   *
 | 
			
		||||
   * Note: copied from _menu_link_translate() in menu.inc, but reduced to the
 | 
			
		||||
   * minimal code that's used.
 | 
			
		||||
   *
 | 
			
		||||
   * @param array $link
 | 
			
		||||
   *   A book link.
 | 
			
		||||
   */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -423,36 +423,6 @@ function menu_ui_form_node_type_form_builder($entity_type, NodeTypeInterface $ty
 | 
			
		|||
  $type->setThirdPartySetting('menu_ui', 'parent', $form_state->getValue('menu_parent'));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Return an associative array of the custom menus names.
 | 
			
		||||
 *
 | 
			
		||||
 * @param bool $all
 | 
			
		||||
 *   (optional) If FALSE return only user-added menus, or if TRUE also include
 | 
			
		||||
 *   the menus defined by the system. Defaults to TRUE.
 | 
			
		||||
 *
 | 
			
		||||
 * @return array
 | 
			
		||||
 *   An array with the machine-readable names as the keys, and human-readable
 | 
			
		||||
 *   titles as the values.
 | 
			
		||||
 *
 | 
			
		||||
 * @deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use
 | 
			
		||||
 *   \Drupal\system\Entity\Menu::loadMultiple() instead.
 | 
			
		||||
 *
 | 
			
		||||
 * @see https://www.drupal.org/node/3027453
 | 
			
		||||
 */
 | 
			
		||||
function menu_ui_get_menus($all = TRUE) {
 | 
			
		||||
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\system\Entity\Menu::loadMultiple() instead. See https://www.drupal.org/node/3027453', E_USER_DEPRECATED);
 | 
			
		||||
  if ($custom_menus = Menu::loadMultiple()) {
 | 
			
		||||
    if (!$all) {
 | 
			
		||||
      $custom_menus = array_diff_key($custom_menus, menu_list_system_menus());
 | 
			
		||||
    }
 | 
			
		||||
    foreach ($custom_menus as $menu_name => $menu) {
 | 
			
		||||
      $custom_menus[$menu_name] = $menu->label();
 | 
			
		||||
    }
 | 
			
		||||
    asort($custom_menus);
 | 
			
		||||
  }
 | 
			
		||||
  return $custom_menus;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Implements hook_preprocess_HOOK() for block templates.
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,55 +0,0 @@
 | 
			
		|||
<?php
 | 
			
		||||
 | 
			
		||||
namespace Drupal\KernelTests\Core\Menu;
 | 
			
		||||
 | 
			
		||||
use Drupal\KernelTests\KernelTestBase;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Deprecation test cases for the menu layer.
 | 
			
		||||
 *
 | 
			
		||||
 * @group legacy
 | 
			
		||||
 */
 | 
			
		||||
class MenuLegacyTest extends KernelTestBase {
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  protected static $modules = ['menu_ui', 'system', 'user'];
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * {@inheritdoc}
 | 
			
		||||
   */
 | 
			
		||||
  protected function setUp(): void {
 | 
			
		||||
    parent::setUp();
 | 
			
		||||
    $this->installConfig('system');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Tests deprecation of the menu_list_system_menus() function.
 | 
			
		||||
   */
 | 
			
		||||
  public function testListSystemMenus(): void {
 | 
			
		||||
    $this->expectDeprecation('menu_list_system_menus() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\system\Entity\Menu::loadMultiple() instead. See https://www.drupal.org/node/3027453');
 | 
			
		||||
    $this->assertSame([
 | 
			
		||||
      'tools' => 'Tools',
 | 
			
		||||
      'admin' => 'Administration',
 | 
			
		||||
      'account' => 'User account menu',
 | 
			
		||||
      'main' => 'Main navigation',
 | 
			
		||||
      'footer' => 'Footer menu',
 | 
			
		||||
    ], menu_list_system_menus());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Tests deprecation of the menu_ui_get_menus() function.
 | 
			
		||||
   */
 | 
			
		||||
  public function testMenuUiGetMenus(): void {
 | 
			
		||||
    $this->expectDeprecation('menu_ui_get_menus() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\system\Entity\Menu::loadMultiple() instead. See https://www.drupal.org/node/3027453');
 | 
			
		||||
    $this->assertSame([
 | 
			
		||||
      'admin' => 'Administration',
 | 
			
		||||
      'footer' => 'Footer',
 | 
			
		||||
      'main' => 'Main navigation',
 | 
			
		||||
      'tools' => 'Tools',
 | 
			
		||||
      'account' => 'User account menu',
 | 
			
		||||
    ], menu_ui_get_menus());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue