update drupal
This commit is contained in:
@@ -60,10 +60,15 @@ class FieldLink extends ProcessPluginBase {
|
||||
*/
|
||||
protected function canonicalizeUri($uri) {
|
||||
// If we already have a scheme, we're fine.
|
||||
if (empty($uri) || parse_url($uri, PHP_URL_SCHEME)) {
|
||||
if (parse_url($uri, PHP_URL_SCHEME)) {
|
||||
return $uri;
|
||||
}
|
||||
|
||||
// Empty URI and non-links are allowed.
|
||||
if (empty($uri) || in_array($uri, ['<nolink>', '<none>'])) {
|
||||
return 'route:<nolink>';
|
||||
}
|
||||
|
||||
// Remove the <front> component of the URL.
|
||||
if (strpos($uri, '<front>') === 0) {
|
||||
$uri = substr($uri, strlen('<front>'));
|
||||
|
||||
@@ -727,7 +727,9 @@ class LinkFieldTest extends BrowserTestBase {
|
||||
$entity_test_link = $entity_test_storage->create(['name' => 'correct link target']);
|
||||
$entity_test_link->save();
|
||||
|
||||
$node = $this->drupalCreateNode(['wrong link target']);
|
||||
// Create a node with the same ID as the test entity to ensure that the link
|
||||
// doesn't match incorrectly.
|
||||
$this->drupalCreateNode(['title' => 'wrong link target']);
|
||||
|
||||
$correct_link = 'entity:entity_test/' . $entity_test_link->id();
|
||||
$entity_test = $entity_test_storage->create([
|
||||
|
||||
@@ -86,6 +86,18 @@ class FieldLinkTest extends UnitTestCase {
|
||||
'http://www.example.com/page#links',
|
||||
'http://www.example.com/page#links',
|
||||
],
|
||||
'empty' => [
|
||||
'',
|
||||
'route:<nolink>',
|
||||
],
|
||||
'No link' => [
|
||||
'<nolink>',
|
||||
'route:<nolink>',
|
||||
],
|
||||
'none' => [
|
||||
'<none>',
|
||||
'route:<nolink>',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user