diff --git a/core/includes/common.inc b/core/includes/common.inc index 8f710ce..e57821e 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -639,9 +639,6 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) { * alternative than url(). * * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromPath(). - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. - * System paths should not be used - use route names and parameters. */ function url($path = NULL, array $options = array()) { return \Drupal::urlGenerator()->generateFromPath($path, $options); diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 0511193..64f252d 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -240,6 +240,15 @@ public function isExternal() { } /** + * Indicates if this Url has a Drupal route. + * + * @return bool + */ + public function isRouted() { + return !$this->unrouted; + } + + /** * Returns the route name. * * @return string diff --git a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php index a23972f..65e37bf 100644 --- a/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php +++ b/core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php @@ -208,7 +208,11 @@ protected function buildUrl(LinkItemInterface $item) { if ($item->isExternal()) { // @todo LinkItemInterface shouldn't treat items with no scheme as - // external, including . + // external, including . All the code here should be removed + // except the first case where we have a valid scheme. There needs to + // be some fixes in RDF module since changing this causes failures in + // Drupal\rdf\Tests\Field\LinkFieldRdfaTest + // https://www.drupal.org/node/2346645 if (parse_url($item->url, PHP_URL_SCHEME)) { $url = Url::unrouted($item->url, $options); } diff --git a/core/tests/Drupal/Tests/Core/ExternalUrlTest.php b/core/tests/Drupal/Tests/Core/ExternalUrlTest.php index 5073689..972e2db 100644 --- a/core/tests/Drupal/Tests/Core/ExternalUrlTest.php +++ b/core/tests/Drupal/Tests/Core/ExternalUrlTest.php @@ -22,7 +22,7 @@ class ExternalUrlTest extends UnitTestCase { /** * The URL assembler * - * @var \Drupal\Core\Routing\UrlGeneratorInterface|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Utility\UnroutedUrlAssemblerInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $urlAssembler; @@ -170,7 +170,7 @@ public function testGetInternalPath(Url $url) { * * @depends testCreateFromPath * - * @covers ::getPath() + * @covers ::getUri() */ public function testGetUri(Url $url) { $this->assertNotNull($url->getUri());