diff --git a/core/modules/link/lib/Drupal/link/Plugin/Field/FieldWidget/LinkWidget.php b/core/modules/link/lib/Drupal/link/Plugin/Field/FieldWidget/LinkWidget.php index f9ff68a..baf1eb5 100644 --- a/core/modules/link/lib/Drupal/link/Plugin/Field/FieldWidget/LinkWidget.php +++ b/core/modules/link/lib/Drupal/link/Plugin/Field/FieldWidget/LinkWidget.php @@ -207,9 +207,9 @@ public function massageFormValues(array $values, array $form, array &$form_state try { $parsed_url = UrlHelper::parse($value['url']); - // If the widget supports internal links, ensure that if this is a - // path alias that the system path is stored. - if ($this->supportsInternalLinks() && !UrlHelper::isExternal($parsed_url['path'])) { + // If internal links are supported, look up whether the given value is + // a path alias and store the system path instead. + if ($this->supportsInternalLinks() && !UrlHelper::isExternal($value['url'])) { $parsed_url['path'] = \Drupal::service('path.alias_manager.cached')->getSystemPath($parsed_url['path']); } diff --git a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php index 5b7b17b..01f7ed7 100644 --- a/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php +++ b/core/modules/link/lib/Drupal/link/Tests/LinkFieldTest.php @@ -104,7 +104,7 @@ function testURLValidation() { $this->assertRaw('placeholder="http://example.com"'); // Create a path alias. - \Drupal::service('path.crud')->save('admin', 'a/path/alias'); + \Drupal::service('path.alias_storage')->save('admin', 'a/path/alias'); // Define some valid URLs. $valid_external_entries = array( 'http://www.example.com/',