diff --git a/core/core.api.php b/core/core.api.php index cfb8800728..087b80aacf 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -762,7 +762,7 @@ * A typical service definition in a *.services.yml file looks like this: * @code * path.alias_manager: - * class: Drupal\Core\Path\AliasManager + * class: Drupal\path\AliasManager * arguments: ['@path.crud', '@path.alias_whitelist', '@language_manager'] * @endcode * Some services use other services as factories; a typical service definition diff --git a/core/core.services.yml b/core/core.services.yml index 1cddf59cfe..93f7e76c88 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -454,14 +454,6 @@ services: queue.database: class: Drupal\Core\Queue\QueueDatabaseFactory arguments: ['@database'] - path.alias_whitelist: - class: Drupal\Core\Path\AliasWhitelist - tags: - - { name: needs_destruction } - arguments: [path_alias_whitelist, '@cache.bootstrap', '@lock', '@state', '@path.alias_storage'] - path.alias_manager: - class: Drupal\Core\Path\AliasManager - arguments: ['@path.alias_storage', '@path.alias_whitelist', '@language_manager', '@cache.data'] path.current: class: Drupal\Core\Path\CurrentPathStack arguments: ['@request_stack'] @@ -1209,11 +1201,6 @@ services: arguments: ['@maintenance_mode', '@config.factory', '@string_translation', '@url_generator', '@current_user', '@bare_html_page_renderer', '@messenger'] tags: - { name: event_subscriber } - path_subscriber: - class: Drupal\Core\EventSubscriber\PathSubscriber - tags: - - { name: event_subscriber } - arguments: ['@path.alias_manager', '@path.current'] route_access_response_subscriber: class: Drupal\Core\EventSubscriber\RouteAccessResponseSubscriber tags: @@ -1339,12 +1326,6 @@ services: arguments: ['@current_route_match'] tags: - { name: route_processor_outbound, priority: 200 } - path_processor_alias: - class: Drupal\Core\PathProcessor\PathProcessorAlias - tags: - - { name: path_processor_inbound, priority: 100 } - - { name: path_processor_outbound, priority: 300 } - arguments: ['@path.alias_manager'] route_processor_csrf: class: Drupal\Core\Access\RouteProcessorCsrf tags: diff --git a/core/lib/Drupal/Core/Path/AliasStorage.php b/core/lib/Drupal/Core/Path/AliasStorage.php index 7de344a781..8ec388d28a 100644 --- a/core/lib/Drupal/Core/Path/AliasStorage.php +++ b/core/lib/Drupal/Core/Path/AliasStorage.php @@ -73,7 +73,7 @@ public function save($source, $alias, $langcode = LanguageInterface::LANGCODE_NO } if ($pid) { - /** @var \Drupal\Core\Path\PathAliasInterface $path_alias */ + /** @var \Drupal\path\PathAliasInterface $path_alias */ $path_alias = $this->getPathAliasEntityStorage()->load($pid); $original_values = [ 'source' => $path_alias->getPath(), @@ -133,7 +133,7 @@ public function load($conditions) { ->execute(); $entities = $this->getPathAliasEntityStorage()->loadMultiple($result); - /** @var \Drupal\Core\Path\PathAliasInterface $path_alias */ + /** @var \Drupal\path\PathAliasInterface $path_alias */ $path_alias = reset($entities); if ($path_alias) { return [ diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index d31f293e18..1df331b894 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -467,8 +467,8 @@ protected function getRouteCollectionCacheId(Request $request) { */ protected function getCurrentLanguageCacheIdPart() { // This must be in sync with the language logic in - // \Drupal\Core\PathProcessor\PathProcessorAlias::processInbound() and - // \Drupal\Core\Path\AliasManager::getPathByAlias(). + // \Drupal\path\PathProcessor\AliasPathProcessor::processInbound() and + // \Drupal\path\AliasManager::getPathByAlias(). // @todo Update this if necessary in https://www.drupal.org/node/1125428. return $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_URL)->getId(); } diff --git a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockContentTranslationTest.php b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockContentTranslationTest.php index db255d79f8..273604c953 100644 --- a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockContentTranslationTest.php +++ b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockContentTranslationTest.php @@ -24,6 +24,7 @@ class MigrateBlockContentTranslationTest extends MigrateDrupal6TestBase { 'block_content', 'content_translation', 'language', + 'path', 'statistics', 'taxonomy', // Required for translation migrations. diff --git a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php index 6ea998b0c9..99e2d75a7a 100644 --- a/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php +++ b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php @@ -26,6 +26,7 @@ class MigrateBlockTest extends MigrateDrupal6TestBase { 'aggregator', 'book', 'forum', + 'path', 'statistics', ]; diff --git a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockContentTranslationTest.php b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockContentTranslationTest.php index 3201d02b16..45ac639159 100644 --- a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockContentTranslationTest.php +++ b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockContentTranslationTest.php @@ -28,6 +28,7 @@ class MigrateBlockContentTranslationTest extends MigrateDrupal7TestBase { 'config_translation', 'content_translation', 'language', + 'path', 'statistics', 'taxonomy', // Required for translation migrations. diff --git a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php index 929854165a..dbcc810bd5 100644 --- a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php +++ b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php @@ -25,6 +25,7 @@ class MigrateBlockTest extends MigrateDrupal7TestBase { 'node', 'text', 'filter', + 'path', 'user', ]; diff --git a/core/modules/jsonapi/tests/src/Functional/PathAliasTest.php b/core/modules/jsonapi/tests/src/Functional/PathAliasTest.php index 873cb2abad..f3aecaacd5 100644 --- a/core/modules/jsonapi/tests/src/Functional/PathAliasTest.php +++ b/core/modules/jsonapi/tests/src/Functional/PathAliasTest.php @@ -2,7 +2,7 @@ namespace Drupal\Tests\jsonapi\Functional; -use Drupal\Core\Path\Entity\PathAlias; +use Drupal\path\Entity\PathAlias; use Drupal\Core\Url; /** diff --git a/core/modules/menu_link_content/menu_link_content.module b/core/modules/menu_link_content/menu_link_content.module index 48dafd76d3..27c9e68c0e 100644 --- a/core/modules/menu_link_content/menu_link_content.module +++ b/core/modules/menu_link_content/menu_link_content.module @@ -7,7 +7,7 @@ use Drupal\Core\Url; use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Path\PathAliasInterface; +use Drupal\path\PathAliasInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\system\MenuInterface; diff --git a/core/modules/menu_link_content/tests/src/Kernel/PathAliasMenuLinkContentTest.php b/core/modules/menu_link_content/tests/src/Kernel/PathAliasMenuLinkContentTest.php index c0cdba31b8..4f13b9c068 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/PathAliasMenuLinkContentTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/PathAliasMenuLinkContentTest.php @@ -18,7 +18,7 @@ class PathAliasMenuLinkContentTest extends KernelTestBase { /** * {@inheritdoc} */ - public static $modules = ['menu_link_content', 'system', 'link', 'test_page_test', 'user']; + public static $modules = ['menu_link_content', 'system', 'link', 'path', 'test_page_test', 'user']; /** * {@inheritdoc} diff --git a/core/modules/path/path.info.yml b/core/modules/path/path.info.yml index ba2c759c99..1713e7bb53 100644 --- a/core/modules/path/path.info.yml +++ b/core/modules/path/path.info.yml @@ -4,4 +4,5 @@ description: 'Allows users to rename URLs.' package: Core version: VERSION core: 8.x +required: true configure: path.admin_overview diff --git a/core/modules/path/path.module b/core/modules/path/path.module index f344c74b6e..71afb4ec99 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -5,11 +5,12 @@ * Enables users to rename URLs. */ -use Drupal\Core\Url; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\Url; +use Drupal\path\Form\SystemInformationFormAlter; /** * Implements hook_help(). @@ -69,3 +70,12 @@ function path_entity_translation_create(ContentEntityInterface $translation) { } } } + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function path_form_system_site_information_settings_alter(array &$form) { + Drupal::classResolver() + ->getInstanceFromDefinition(SystemInformationFormAlter::class) + ->alterForm($form); +} diff --git a/core/modules/path/path.services.yml b/core/modules/path/path.services.yml new file mode 100644 index 0000000000..bf34794392 --- /dev/null +++ b/core/modules/path/path.services.yml @@ -0,0 +1,22 @@ +services: + path.alias_whitelist: + class: Drupal\path\AliasWhitelist + tags: + - { name: needs_destruction } + arguments: [path_alias_whitelist, '@cache.bootstrap', '@lock', '@state', '@path.alias_storage'] + path.alias_manager: + class: Drupal\path\AliasManager + arguments: ['@path.alias_storage', '@path.alias_whitelist', '@language_manager', '@cache.data'] + + path.alias_subscriber: + class: Drupal\path\EventSubscriber\PathAliasSubscriber + tags: + - { name: event_subscriber } + arguments: ['@path.alias_manager', '@path.current'] + + path_processor_alias: + class: Drupal\path\PathProcessor\AliasPathProcessor + tags: + - { name: path_processor_inbound, priority: 100 } + - { name: path_processor_outbound, priority: 300 } + arguments: ['@path.alias_manager'] diff --git a/core/lib/Drupal/Core/Path/AliasManager.php b/core/modules/path/src/AliasManager.php similarity index 98% rename from core/lib/Drupal/Core/Path/AliasManager.php rename to core/modules/path/src/AliasManager.php index 39472797ad..6731a314c1 100644 --- a/core/lib/Drupal/Core/Path/AliasManager.php +++ b/core/modules/path/src/AliasManager.php @@ -1,11 +1,12 @@ aliasManager = $alias_manager; + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container) { + return new static($container->get('path.alias_manager')); + } + + /** + * Alters the specified form. + * + * @param array $form + * A form array. + */ + public function alterForm(array &$form) { + $front_page = &$form['front_page']['site_frontpage']['#default_value']; + if ($front_page !== '') { + $front_page = $this->aliasManager->getAliasByPath($front_page); + } + array_unshift($form['#validate'], [$this, 'validateForm']); + } + + /** + * Validates the specified form. + * + * @param array $form + * A form array. + * @param \Drupal\Core\Form\FormStateInterface $form_state + * The form state. + */ + public function validateForm(array $form, FormStateInterface $form_state) { + // Check for empty front page path. + if (!$form_state->isValueEmpty('site_frontpage')) { + // Get the normal path of the front page. + $form_state->setValueForElement($form['front_page']['site_frontpage'], $this->aliasManager->getPathByAlias($form_state->getValue('site_frontpage'))); + } + + // Get the normal paths of both error pages. + if (!$form_state->isValueEmpty('site_403')) { + $form_state->setValueForElement($form['error_page']['site_403'], $this->aliasManager->getPathByAlias($form_state->getValue('site_403'))); + } + + if (!$form_state->isValueEmpty('site_404')) { + $form_state->setValueForElement($form['error_page']['site_404'], $this->aliasManager->getPathByAlias($form_state->getValue('site_404'))); + } + } + +} diff --git a/core/lib/Drupal/Core/Path/PathAliasInterface.php b/core/modules/path/src/PathAliasInterface.php similarity index 96% rename from core/lib/Drupal/Core/Path/PathAliasInterface.php rename to core/modules/path/src/PathAliasInterface.php index 73d2b4569f..26c6e55860 100644 --- a/core/lib/Drupal/Core/Path/PathAliasInterface.php +++ b/core/modules/path/src/PathAliasInterface.php @@ -1,6 +1,6 @@ aliasStorage = $this->createMock('Drupal\Core\Path\AliasStorageInterface'); - $this->aliasWhitelist = $this->createMock('Drupal\Core\Path\AliasWhitelistInterface'); + $this->aliasWhitelist = $this->createMock('Drupal\path\AliasWhitelistInterface'); $this->languageManager = $this->createMock('Drupal\Core\Language\LanguageManagerInterface'); $this->cache = $this->createMock('Drupal\Core\Cache\CacheBackendInterface'); diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php b/core/modules/path/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php similarity index 77% rename from core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php rename to core/modules/path/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php index 8a2a17ecd6..8d7c32e96f 100644 --- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorAliasTest.php +++ b/core/modules/path/tests/src/Unit/PathProcessor/AliasPathProcessorTest.php @@ -1,42 +1,43 @@ aliasManager = $this->createMock('Drupal\Core\Path\AliasManagerInterface'); - $this->pathProcessor = new PathProcessorAlias($this->aliasManager); + $this->aliasManager = $this->createMock('Drupal\path\AliasManagerInterface'); + $this->pathProcessor = new AliasPathProcessor($this->aliasManager); } /** * Tests the processInbound method. * - * @see \Drupal\Core\PathProcessor\PathProcessorAlias::processInbound + * @see \Drupal\Core\PathProcessor\AliasPathProcessor::processInbound */ public function testProcessInbound() { $this->aliasManager->expects($this->exactly(2)) diff --git a/core/modules/system/src/Form/SiteInformationForm.php b/core/modules/system/src/Form/SiteInformationForm.php index 4e4e1571fd..3529e0aa99 100644 --- a/core/modules/system/src/Form/SiteInformationForm.php +++ b/core/modules/system/src/Form/SiteInformationForm.php @@ -3,9 +3,8 @@ namespace Drupal\system\Form; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Path\AliasManagerInterface; use Drupal\Core\Form\ConfigFormBase; +use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Path\PathValidatorInterface; use Drupal\Core\Routing\RequestContext; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -17,13 +16,6 @@ */ class SiteInformationForm extends ConfigFormBase { - /** - * The path alias manager. - * - * @var \Drupal\Core\Path\AliasManagerInterface - */ - protected $aliasManager; - /** * The path validator. * @@ -43,17 +35,14 @@ class SiteInformationForm extends ConfigFormBase { * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The factory for configuration objects. - * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager - * The path alias manager. * @param \Drupal\Core\Path\PathValidatorInterface $path_validator * The path validator. * @param \Drupal\Core\Routing\RequestContext $request_context * The request context. */ - public function __construct(ConfigFactoryInterface $config_factory, AliasManagerInterface $alias_manager, PathValidatorInterface $path_validator, RequestContext $request_context) { + public function __construct(ConfigFactoryInterface $config_factory, PathValidatorInterface $path_validator, RequestContext $request_context) { parent::__construct($config_factory); - $this->aliasManager = $alias_manager; $this->pathValidator = $path_validator; $this->requestContext = $request_context; } @@ -64,7 +53,6 @@ public function __construct(ConfigFactoryInterface $config_factory, AliasManager public static function create(ContainerInterface $container) { return new static( $container->get('config.factory'), - $container->get('path.alias_manager'), $container->get('path.validator'), $container->get('router.request_context') ); @@ -123,7 +111,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => t('Front page'), '#open' => TRUE, ]; - $front_page = $site_config->get('page.front') != '/user/login' ? $this->aliasManager->getAliasByPath($site_config->get('page.front')) : ''; + $front_page = $site_config->get('page.front') !== '/user/login' ? $site_config->get('page.front') : ''; $form['front_page']['site_frontpage'] = [ '#type' => 'textfield', '#title' => t('Default front page'), @@ -164,10 +152,6 @@ public function validateForm(array &$form, FormStateInterface $form_state) { // Set to default "user/login". $form_state->setValueForElement($form['front_page']['site_frontpage'], '/user/login'); } - else { - // Get the normal path of the front page. - $form_state->setValueForElement($form['front_page']['site_frontpage'], $this->aliasManager->getPathByAlias($form_state->getValue('site_frontpage'))); - } // Validate front page path. if (($value = $form_state->getValue('site_frontpage')) && $value[0] !== '/') { $form_state->setErrorByName('site_frontpage', $this->t("The path '%path' has to start with a slash.", ['%path' => $form_state->getValue('site_frontpage')])); @@ -176,13 +160,6 @@ public function validateForm(array &$form, FormStateInterface $form_state) { if (!$this->pathValidator->isValid($form_state->getValue('site_frontpage'))) { $form_state->setErrorByName('site_frontpage', $this->t("Either the path '%path' is invalid or you do not have access to it.", ['%path' => $form_state->getValue('site_frontpage')])); } - // Get the normal paths of both error pages. - if (!$form_state->isValueEmpty('site_403')) { - $form_state->setValueForElement($form['error_page']['site_403'], $this->aliasManager->getPathByAlias($form_state->getValue('site_403'))); - } - if (!$form_state->isValueEmpty('site_404')) { - $form_state->setValueForElement($form['error_page']['site_404'], $this->aliasManager->getPathByAlias($form_state->getValue('site_404'))); - } if (($value = $form_state->getValue('site_403')) && $value[0] !== '/') { $form_state->setErrorByName('site_403', $this->t("The path '%path' has to start with a slash.", ['%path' => $form_state->getValue('site_403')])); } diff --git a/core/modules/system/src/Plugin/Condition/RequestPath.php b/core/modules/system/src/Plugin/Condition/RequestPath.php index 1f73624774..15743f864c 100644 --- a/core/modules/system/src/Plugin/Condition/RequestPath.php +++ b/core/modules/system/src/Plugin/Condition/RequestPath.php @@ -4,7 +4,7 @@ use Drupal\Core\Condition\ConditionPluginBase; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path\AliasManagerInterface; use Drupal\Core\Path\CurrentPathStack; use Drupal\Core\Path\PathMatcherInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; @@ -24,7 +24,7 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI /** * An alias manager to find the alias for the current system path. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path\AliasManagerInterface */ protected $aliasManager; @@ -52,7 +52,7 @@ class RequestPath extends ConditionPluginBase implements ContainerFactoryPluginI /** * Constructs a RequestPath condition plugin. * - * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager + * @param \Drupal\path\AliasManagerInterface $alias_manager * An alias manager to find the alias for the current system path. * @param \Drupal\Core\Path\PathMatcherInterface $path_matcher * The path matcher service. diff --git a/core/modules/system/src/Tests/Routing/MockAliasManager.php b/core/modules/system/src/Tests/Routing/MockAliasManager.php index 09f36366fc..7f764422d2 100644 --- a/core/modules/system/src/Tests/Routing/MockAliasManager.php +++ b/core/modules/system/src/Tests/Routing/MockAliasManager.php @@ -2,7 +2,7 @@ namespace Drupal\system\Tests\Routing; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path\AliasManagerInterface; /** * An easily configurable mock alias manager. diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 69433cf897..38ccb58a37 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -20,9 +20,9 @@ use Drupal\Core\Extension\Extension; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\File\FileSystemInterface; -use Drupal\Core\Path\Entity\PathAlias; -use Drupal\Core\Path\PathAliasStorage; -use Drupal\Core\Path\PathAliasStorageSchema; +use Drupal\path\Entity\PathAlias; +use Drupal\path\PathAliasStorage; +use Drupal\path\PathAliasStorageSchema; use Drupal\Core\Site\Settings; use Drupal\Core\StreamWrapper\PrivateStream; use Drupal\Core\StreamWrapper\PublicStream; @@ -2362,6 +2362,11 @@ function system_update_8802() { * Install the 'path_alias' entity type. */ function system_update_8803() { + // Enable the Path module if needed. + if (!\Drupal::moduleHandler()->moduleExists('path')) { + \Drupal::service('module_installer')->install(['path'], FALSE); + } + $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager(); if (!$entity_definition_update_manager->getEntityType('path_alias')) { $entity_type = new ContentEntityType([ diff --git a/core/modules/user/tests/src/Kernel/Views/ArgumentValidateTest.php b/core/modules/user/tests/src/Kernel/Views/ArgumentValidateTest.php index 76bfad7ce4..1f2d14cc38 100644 --- a/core/modules/user/tests/src/Kernel/Views/ArgumentValidateTest.php +++ b/core/modules/user/tests/src/Kernel/Views/ArgumentValidateTest.php @@ -23,6 +23,7 @@ class ArgumentValidateTest extends ViewsKernelTestBase { */ public static $modules = [ 'node', + 'path', 'user_test_views', ]; diff --git a/core/modules/views/src/Plugin/views/argument_default/Raw.php b/core/modules/views/src/Plugin/views/argument_default/Raw.php index 2491bd83c0..169b174cbd 100644 --- a/core/modules/views/src/Plugin/views/argument_default/Raw.php +++ b/core/modules/views/src/Plugin/views/argument_default/Raw.php @@ -5,7 +5,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\CacheableDependencyInterface; use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path\AliasManagerInterface; use Drupal\Core\Path\CurrentPathStack; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -24,7 +24,7 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf /** * The alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path\AliasManagerInterface */ protected $aliasManager; @@ -44,7 +44,7 @@ class Raw extends ArgumentDefaultPluginBase implements CacheableDependencyInterf * The plugin_id for the plugin instance. * @param mixed $plugin_definition * The plugin implementation definition. - * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager + * @param \Drupal\path\AliasManagerInterface $alias_manager * The alias manager. * @param \Drupal\Core\Path\CurrentPathStack $current_path * The current path. diff --git a/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php b/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php index cc8f2c78df..95ca657687 100644 --- a/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/argument_default/RawTest.php @@ -33,7 +33,7 @@ public function testGetArgument() { $view->expects($this->any()) ->method('getRequest') ->will($this->returnValue($request)); - $alias_manager = $this->createMock('Drupal\Core\Path\AliasManagerInterface'); + $alias_manager = $this->createMock('Drupal\path\AliasManagerInterface'); $alias_manager->expects($this->never()) ->method('getAliasByPath'); @@ -71,7 +71,7 @@ public function testGetArgument() { $this->assertEquals(NULL, $raw->getArgument()); // Setup an alias manager with a path alias. - $alias_manager = $this->createMock('Drupal\Core\Path\AliasManagerInterface'); + $alias_manager = $this->createMock('Drupal\path\AliasManagerInterface'); $alias_manager->expects($this->any()) ->method('getAliasByPath') ->with($this->equalTo('/test/example')) diff --git a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php index b072bc1925..73c751c7ea 100644 --- a/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php +++ b/core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php @@ -8,7 +8,7 @@ use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\File\Exception\FileException; use Drupal\Core\File\FileSystemInterface; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path\AliasManagerInterface; use Drupal\Core\State\StateInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -23,7 +23,7 @@ class InstallHelper implements ContainerInjectionInterface { /** * The path alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path\AliasManagerInterface */ protected $aliasManager; @@ -88,7 +88,7 @@ class InstallHelper implements ContainerInjectionInterface { /** * Constructs a new InstallHelper object. * - * @param \Drupal\Core\Path\AliasManagerInterface $aliasManager + * @param \Drupal\path\AliasManagerInterface $aliasManager * The path alias manager. * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager * Entity type manager. diff --git a/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php index 47fa613ab2..e26b9a0112 100644 --- a/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php +++ b/core/tests/Drupal/KernelTests/Core/Command/DbDumpTest.php @@ -22,7 +22,7 @@ class DbDumpTest extends KernelTestBase { /** * {@inheritdoc} */ - public static $modules = ['system', 'config', 'dblog', 'menu_link_content', 'link', 'block_content', 'file', 'user']; + public static $modules = ['system', 'config', 'dblog', 'menu_link_content', 'link', 'block_content', 'file', 'path', 'user']; /** * Test data to write into config. diff --git a/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php index 7f3e44bb40..fd21d111d7 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Config/CacheabilityMetadataConfigOverrideTest.php @@ -20,6 +20,7 @@ class CacheabilityMetadataConfigOverrideTest extends KernelTestBase { 'block_content', 'config', 'config_override_test', + 'path', 'system', 'user', ]; diff --git a/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php b/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php index 0efc69ef14..cb1f08b645 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/CreateSampleEntityTest.php @@ -25,7 +25,7 @@ class CreateSampleEntityTest extends KernelTestBase { /** * {@inheritdoc} */ - public static $modules = ['system', 'field', 'filter', 'text', 'file', 'user', 'node', 'comment', 'taxonomy']; + public static $modules = ['system', 'field', 'filter', 'text', 'file', 'user', 'node', 'comment', 'taxonomy', 'path']; /** * {@inheritdoc} diff --git a/core/tests/Drupal/KernelTests/Core/Path/AliasStorageTest.php b/core/tests/Drupal/KernelTests/Core/Path/AliasStorageTest.php index 2e986d18b3..55d0672edf 100644 --- a/core/tests/Drupal/KernelTests/Core/Path/AliasStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Path/AliasStorageTest.php @@ -14,7 +14,7 @@ class AliasStorageTest extends KernelTestBase { /** * {@inheritdoc} */ - public static $modules = ['system']; + public static $modules = ['path', 'system']; /** * @var \Drupal\Core\Path\AliasStorage diff --git a/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php index a6a7eb839e..e0956d04c5 100644 --- a/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Path/PathValidatorTest.php @@ -22,7 +22,7 @@ class PathValidatorTest extends KernelTestBase { /** * {@inheritdoc} */ - public static $modules = ['path', 'entity_test', 'system', 'user']; + public static $modules = ['entity_test', 'system', 'user']; /** * {@inheritdoc} diff --git a/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php b/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php index 37ac65ae8e..560f2184c1 100644 --- a/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Path/UrlAlterTest.php @@ -17,7 +17,7 @@ class UrlAlterTest extends KernelTestBase { /** * {@inheritdoc} */ - public static $modules = ['path', 'url_alter_test', 'user']; + public static $modules = ['url_alter_test', 'user']; public function testUrlWithQueryString() { // Test outbound query string altering. diff --git a/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php b/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php index ea23b6f8e6..560afbc5e3 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/ContentNegotiationRoutingTest.php @@ -17,7 +17,7 @@ class ContentNegotiationRoutingTest extends KernelTestBase { /** * {@inheritdoc} */ - public static $modules = ['conneg_test']; + public static $modules = ['conneg_test', 'path']; /** * {@inheritdoc} diff --git a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php index 1719687922..9db83b4bec 100644 --- a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php +++ b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php @@ -35,7 +35,7 @@ class RouteProviderTest extends KernelTestBase { /** * Modules to enable. */ - public static $modules = ['url_alter_test', 'system', 'language']; + public static $modules = ['url_alter_test', 'system', 'language', 'path']; /** * A collection of shared fixture data for tests. @@ -575,7 +575,7 @@ public function testRouteCaching() { /** @var \Drupal\Core\Path\AliasStorageInterface $path_storage */ $path_storage = \Drupal::service('path.alias_storage'); $path_storage->save('/path/add/one', '/path/add-one'); - /** @var \Drupal\Core\Path\AliasManagerInterface $alias_manager */ + /** @var \Drupal\path\AliasManagerInterface $alias_manager */ $alias_manager = \Drupal::service('path.alias_manager'); $alias_manager->cacheClear(); diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php index 63b94ff463..2655a1706d 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/ProxyServicesPassTest.php @@ -67,7 +67,7 @@ public function testContainerWithLazyServices() { */ public function testContainerWithLazyServicesWithoutProxyClass() { $container = new ContainerBuilder(); - $container->register('alias_whitelist', 'Drupal\Core\Path\AliasWhitelist') + $container->register('alias_whitelist', 'Drupal\path\AliasWhitelist') ->setLazy(TRUE); $this->expectException(InvalidArgumentException::class); diff --git a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php index ce401b1255..557f578a78 100644 --- a/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php +++ b/core/tests/Drupal/Tests/Core/PathProcessor/PathProcessorTest.php @@ -4,7 +4,7 @@ use Drupal\Core\Language\Language; use Drupal\Core\Language\LanguageInterface; -use Drupal\Core\PathProcessor\PathProcessorAlias; +use Drupal\path\PathProcessor\AliasPathProcessor; use Drupal\Core\PathProcessor\PathProcessorDecode; use Drupal\Core\PathProcessor\PathProcessorFront; use Drupal\Core\PathProcessor\PathProcessorManager; @@ -87,7 +87,7 @@ protected function setUp() { public function testProcessInbound() { // Create an alias manager stub. - $alias_manager = $this->getMockBuilder('Drupal\Core\Path\AliasManager') + $alias_manager = $this->getMockBuilder('Drupal\path\AliasManager') ->disableOriginalConstructor() ->getMock(); @@ -148,7 +148,7 @@ public function testProcessInbound() { ->getMock(); // Create the processors. - $alias_processor = new PathProcessorAlias($alias_manager); + $alias_processor = new AliasPathProcessor($alias_manager); $decode_processor = new PathProcessorDecode(); $front_processor = new PathProcessorFront($config_factory_stub); $language_processor = new PathProcessorLanguage($config_factory_stub, $this->languageManager, $negotiator, $current_user, $config_subscriber); diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index c01aafac0d..e681991199 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -5,7 +5,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; -use Drupal\Core\PathProcessor\PathProcessorAlias; +use Drupal\path\PathProcessor\AliasPathProcessor; use Drupal\Core\PathProcessor\PathProcessorManager; use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Routing\RequestContext; @@ -43,7 +43,7 @@ class UrlGeneratorTest extends UnitTestCase { /** * The alias manager. * - * @var \Drupal\Core\Path\AliasManager|\PHPUnit\Framework\MockObject\MockObject + * @var \Drupal\path\AliasManager|\PHPUnit\Framework\MockObject\MockObject */ protected $aliasManager; @@ -143,7 +143,7 @@ protected function setUp() { ->will($this->returnValueMap($routes_names_return_map)); // Create an alias manager stub. - $alias_manager = $this->getMockBuilder('Drupal\Core\Path\AliasManager') + $alias_manager = $this->getMockBuilder('Drupal\path\AliasManager') ->disableOriginalConstructor() ->getMock(); @@ -160,7 +160,7 @@ protected function setUp() { $this->context = new RequestContext(); $this->context->fromRequestStack($this->requestStack); - $processor = new PathProcessorAlias($this->aliasManager); + $processor = new AliasPathProcessor($this->aliasManager); $processor_manager = new PathProcessorManager(); $processor_manager->addOutbound($processor, 1000); $this->processorManager = $processor_manager; diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php index 4094a48d57..8262118f8d 100644 --- a/core/tests/Drupal/Tests/Core/UrlTest.php +++ b/core/tests/Drupal/Tests/Core/UrlTest.php @@ -42,7 +42,7 @@ class UrlTest extends UnitTestCase { /** * The path alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface|\PHPUnit\Framework\MockObject\MockObject + * @var \Drupal\path\AliasManagerInterface|\PHPUnit\Framework\MockObject\MockObject */ protected $pathAliasManager; @@ -101,7 +101,7 @@ protected function setUp() { ->method('generateFromRoute') ->will($this->returnValueMap($generate_from_route_map)); - $this->pathAliasManager = $this->createMock('Drupal\Core\Path\AliasManagerInterface'); + $this->pathAliasManager = $this->createMock('Drupal\path\AliasManagerInterface'); $this->pathAliasManager->expects($this->any()) ->method('getPathByAlias') ->will($this->returnValueMap($alias_map));