diff --git a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php index a23972f..2d9cc98 100644 --- a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php +++ b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php @@ -207,18 +207,7 @@ protected function buildUrl(LinkItemInterface $item) { } if ($item->isExternal()) { - // @todo LinkItemInterface shouldn't treat items with no scheme as - // external, including . - if (parse_url($item->url, PHP_URL_SCHEME)) { - $url = Url::unrouted($item->url, $options); - } - elseif ($item->url == '') { - $url = new Url(''); - } - else { - // No base path - assume internal. - $url = Url::createFromRequest(Request::create('/' . ltrim($item->url, '/'))); - } + $url = Url::unrouted($item->url, $options); } else { $url = Url::routed($item->route_name, (array) $item->route_parameters, (array) $options); diff --git a/core/modules/rdf/src/Tests/Field/LinkFieldRdfaTest.php b/core/modules/rdf/src/Tests/Field/LinkFieldRdfaTest.php index 8c23c07..8478bae 100644 --- a/core/modules/rdf/src/Tests/Field/LinkFieldRdfaTest.php +++ b/core/modules/rdf/src/Tests/Field/LinkFieldRdfaTest.php @@ -75,7 +75,8 @@ public function testAllFormattersInternal() { // Set up test values. $this->testValue = 'admin'; $this->entity = entity_create('entity_test', array()); - $this->entity->{$this->fieldName}->url = $this->testValue; + $this->entity->{$this->fieldName}->route_name = 'system.admin'; + $this->entity->{$this->fieldName}->url = 'admin'; // Set up the expected result. // AssertFormatterRdfa looks for a full path. @@ -94,7 +95,8 @@ public function testAllFormattersFront() { // Set up test values. $this->testValue = ''; $this->entity = entity_create('entity_test', array()); - $this->entity->{$this->fieldName}->url = $this->testValue; + $this->entity->{$this->fieldName}->route_name = $this->testValue; + $this->entity->{$this->fieldName}->url = ''; // Set up the expected result. $expected_rdf = array(