diff --git a/core/includes/common.inc b/core/includes/common.inc index 7bf85751200..79f16db246e 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -499,9 +499,9 @@ function _format_date_callback(array $matches = NULL, $new_langcode = NULL) { * non-controller or sub-domain URIs such as core/install.php. Note that * \Drupal\Core\Url::fromUri() expects a valid URI including the scheme. URIs * from the same sub-domain that are not handled by Drupal controllers should - * be prepended with base://. For example: + * use the base: scheme. For example: * @code - * $installer_url = \Drupal\Core\Url::fromUri('base://core/install.php')->toString(); + * $installer_url = \Drupal\Core\Url::fromUri('base:core/install.php')->toString(); * $external_url = \Drupal\Core\Url::fromUri('http://example.com', ['query' => ['foo' => 'bar']])->toString(); * $internal_url = \Drupal\Core\Url::fromRoute('system.admin')->toString(); * @endcode @@ -604,9 +604,9 @@ function drupal_http_header_attributes(array $attributes = array()) { * core/install.php use \Drupal\Core\Url::fromUri(). Note that * \Drupal\Core\Url::fromUri() expects a valid URI including the scheme. URIs * from the same sub-domain that are not handled by Drupal controllers should - * be prepended with base://. For example: + * be prepended with base:. For example: * @code - * $installer_url = \Drupal\Core\Url::fromUri('base://core/install.php')->toString(); + * $installer_url = \Drupal\Core\Url::fromUri('base:core/install.php')->toString(); * $installer_link = \Drupal::l($text, $installer_url); * $external_url = \Drupal\Core\Url::fromUri('http://example.com', ['query' => ['foo' => 'bar']])->toString(); * $external_link = \Drupal::l($text, $external_url); diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 06b62c5ef38..4191cdf0019 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -584,7 +584,7 @@ function install_run_task($task, &$install_state) { // Otherwise, the batch will complete. // Disable the default script for the URL and clone the object, as // batch_process() will add additional options to the batch URL. - $url = Url::fromUri('base://install.php', ['query' => $install_state['parameters'], 'script' => '']); + $url = Url::fromUri('base:install.php', ['query' => $install_state['parameters'], 'script' => '']); $response = batch_process($url, clone $url); if ($response instanceof Response) { // Save $_SESSION data from batch. diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php index 7b52d13181d..34c641c0adf 100644 --- a/core/lib/Drupal.php +++ b/core/lib/Drupal.php @@ -476,7 +476,7 @@ class Drupal { * the \Drupal\Core\Url object. See \Drupal\Core\Url::fromRoute() for * detailed documentation. For non-routed local URIs relative to * the base path (like robots.txt) use Url::fromUri()->toString() with the - * base:// scheme. + * base: scheme. * * @param string $route_name * The name of the route. diff --git a/core/lib/Drupal/Core/Form/ConfirmFormHelper.php b/core/lib/Drupal/Core/Form/ConfirmFormHelper.php index b58078d39e1..03c1c4092de 100644 --- a/core/lib/Drupal/Core/Form/ConfirmFormHelper.php +++ b/core/lib/Drupal/Core/Form/ConfirmFormHelper.php @@ -36,7 +36,7 @@ class ConfirmFormHelper { $options = UrlHelper::parse($query->get('destination')); // @todo Use Url::fromPath() once https://www.drupal.org/node/2351379 is // resolved. - $url = Url::fromUri('base://' . $options['path'], $options); + $url = Url::fromUri('base:' . $options['path'], $options); } // Check for a route-based cancel link. else { diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 8b43a5c79b2..560b7f49138 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -139,7 +139,7 @@ class Url { * * This method is for URLs that have Drupal routes (that is, most pages * generated by Drupal). For non-routed local URIs relative to the base - * path (like robots.txt) use Url::fromUri() with the base:// scheme. + * path (like robots.txt) use Url::fromUri() with the base: scheme. * * @param string $route_name * The name of the route @@ -193,7 +193,7 @@ class Url { * * This method is for generating URLs for URIs that: * - do not have Drupal routes: both external URLs and unrouted local URIs - * like base://robots.txt + * like base:robots.txt * - do have a Drupal route but have a custom scheme to simplify linking. * Currently, there is only the entity: scheme (This allows URIs of the * form entity:{entity_type}/{entity_id}. For example: entity:node/1 @@ -204,7 +204,7 @@ class Url { * * @param string $uri * The URI of the resource including the scheme. For Drupal paths that are - * not handled by the routing system, use base:// for the scheme. For entity + * not handled by the routing system, use base: for the scheme. For entity * URLs you may use entity:{entity_type}/{entity_id} URIs. * @param array $options * (optional) An associative array of additional URL options, with the @@ -233,15 +233,18 @@ class Url { */ public static function fromUri($uri, $options = array()) { if (!($scheme = parse_url($uri, PHP_URL_SCHEME))) { - throw new \InvalidArgumentException(String::format('The URI "@uri" is invalid. You must use a valid URI scheme. Use base:// for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal.', ['@uri' => $uri])); + throw new \InvalidArgumentException(String::format('The URI "@uri" is invalid. You must use a valid URI scheme. Use base: for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal.', ['@uri' => $uri])); } // Special case entity: URIs. Map these to the canonical entity route. if ($scheme === 'entity') { return static::fromEntityUri($uri); } - $url = new static($uri, array(), $options); + if ($scheme !== 'base') { + $url->external = TRUE; + $url->setOption('external', TRUE); + } $url->setUnrouted(); return $url; @@ -313,11 +316,6 @@ class Url { // Set empty route name and parameters. $this->routeName = NULL; $this->routeParameters = array(); - // @todo Add a method for the check below in - // https://www.drupal.org/node/2346859. - if ($this->external = strpos($this->uri, 'base://') !== 0) { - $this->options['external'] = TRUE; - } } /** diff --git a/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php index 612ac8754a1..bc21ea817c1 100644 --- a/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssembler.php @@ -61,14 +61,14 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface { // Note that UrlHelper::isExternal will return FALSE if the $uri has a // disallowed protocol. This is later made safe since we always add at // least a leading slash. - if (strpos($uri, 'base://') === 0) { + if (parse_url($uri, PHP_URL_SCHEME) === 'base') { return $this->buildLocalUrl($uri, $options); } elseif (UrlHelper::isExternal($uri)) { // UrlHelper::isExternal() only returns true for safe protocols. return $this->buildExternalUrl($uri, $options); } - throw new \InvalidArgumentException(String::format('The URI "@uri" is invalid. You must use a valid URI scheme. Use base:// for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal.', ['@uri' => $uri])); + throw new \InvalidArgumentException(String::format('The URI "@uri" is invalid. You must use a valid URI scheme. Use base: for a path, e.g., to a Drupal file that needs the base path. Do not use this for internal paths controlled by Drupal.', ['@uri' => $uri])); } /** @@ -108,8 +108,10 @@ class UnroutedUrlAssembler implements UnroutedUrlAssemblerInterface { $this->addOptionDefaults($options); $request = $this->requestStack->getCurrentRequest(); - // Remove the base:// scheme. - $uri = substr($uri, 7); + // Remove the base: scheme. + // @todo Consider using a class constant for this in + // https://www.drupal.org/node/2417459 + $uri = substr($uri, 5); // Allow (outbound) path processing, if needed. A valid use case is the path // alias overview form: diff --git a/core/lib/Drupal/Core/Utility/UnroutedUrlAssemblerInterface.php b/core/lib/Drupal/Core/Utility/UnroutedUrlAssemblerInterface.php index d224a4799e5..868f0c171a4 100644 --- a/core/lib/Drupal/Core/Utility/UnroutedUrlAssemblerInterface.php +++ b/core/lib/Drupal/Core/Utility/UnroutedUrlAssemblerInterface.php @@ -18,11 +18,11 @@ interface UnroutedUrlAssemblerInterface { * domain-local URIs and external URLs. * * @param string $uri - * A local URI or an external URL being linked to, such as "base://foo" + * A local URI or an external URL being linked to, such as "base:foo" * or "http://example.com/foo". * - If you provide a full URL, it will be considered an external URL as * long as it has an allowed protocol. - * - If you provide only a local URI (e.g. "base://foo"), it will be + * - If you provide only a local URI (e.g. "base:foo"), it will be * considered a path local to Drupal, but not handled by the routing * system. The base path (the subdirectory where the front controller * is found) will be added to the path. Additional query arguments for diff --git a/core/modules/dblog/src/Controller/DbLogController.php b/core/modules/dblog/src/Controller/DbLogController.php index e8b1ba5dc07..3470126d5b1 100644 --- a/core/modules/dblog/src/Controller/DbLogController.php +++ b/core/modules/dblog/src/Controller/DbLogController.php @@ -255,11 +255,11 @@ class DbLogController extends ControllerBase { ), array( array('data' => $this->t('Location'), 'header' => TRUE), - $this->l($dblog->location, $dblog->location ? Url::fromUri('base://' . $dblog->location) : Url::fromRoute('')), + $this->l($dblog->location, $dblog->location ? Url::fromUri('base:' . $dblog->location) : Url::fromRoute('')), ), array( array('data' => $this->t('Referrer'), 'header' => TRUE), - $this->l($dblog->referer, $dblog->referer ? Url::fromUri('base://' . $dblog->referer) : Url::fromRoute('')), + $this->l($dblog->referer, $dblog->referer ? Url::fromUri('base:' . $dblog->referer) : Url::fromRoute('')), ), array( array('data' => $this->t('Message'), 'header' => TRUE), diff --git a/core/modules/field_ui/src/FieldUI.php b/core/modules/field_ui/src/FieldUI.php index 4bbd93a9853..c6b33edb26f 100644 --- a/core/modules/field_ui/src/FieldUI.php +++ b/core/modules/field_ui/src/FieldUI.php @@ -63,7 +63,7 @@ class FieldUI { // Redirect to any given path within the same domain. // @todo Use Url::fromPath() once https://www.drupal.org/node/2351379 is // resolved. - $next_destination = Url::fromUri('base://' . $options['path']); + $next_destination = Url::fromUri('base:' . $options['path']); } return $next_destination; } diff --git a/core/modules/hal/src/Tests/DenormalizeTest.php b/core/modules/hal/src/Tests/DenormalizeTest.php index cbb593c24aa..799585bc6d1 100644 --- a/core/modules/hal/src/Tests/DenormalizeTest.php +++ b/core/modules/hal/src/Tests/DenormalizeTest.php @@ -25,7 +25,7 @@ class DenormalizeTest extends NormalizerTestBase { $data_with_valid_type = array( '_links' => array( 'type' => array( - 'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), ), ), ); @@ -37,10 +37,10 @@ class DenormalizeTest extends NormalizerTestBase { '_links' => array( 'type' => array( array( - 'href' => Url::fromUri('base://rest/types/foo', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/types/foo', array('absolute' => TRUE))->toString(), ), array( - 'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), ), ), ), @@ -52,7 +52,7 @@ class DenormalizeTest extends NormalizerTestBase { $data_with_invalid_type = array( '_links' => array( 'type' => array( - 'href' => Url::fromUri('base://rest/types/foo', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/types/foo', array('absolute' => TRUE))->toString(), ), ), ); @@ -85,7 +85,7 @@ class DenormalizeTest extends NormalizerTestBase { $no_field_data = array( '_links' => array( 'type' => array( - 'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), ), ), ); @@ -95,7 +95,7 @@ class DenormalizeTest extends NormalizerTestBase { $empty_field_data = array( '_links' => array( 'type' => array( - 'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), ), ), 'field_test_text' => array(), @@ -113,7 +113,7 @@ class DenormalizeTest extends NormalizerTestBase { $data = array( '_links' => array( 'type' => array( - 'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), ), ), 'uuid' => array( @@ -183,7 +183,7 @@ class DenormalizeTest extends NormalizerTestBase { $data = array( '_links' => array( 'type' => array( - 'href' => Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(), ), ), 'field_test_text' => array( diff --git a/core/modules/hal/src/Tests/NormalizeTest.php b/core/modules/hal/src/Tests/NormalizeTest.php index 183430fcb46..9525f056ca1 100644 --- a/core/modules/hal/src/Tests/NormalizeTest.php +++ b/core/modules/hal/src/Tests/NormalizeTest.php @@ -61,8 +61,8 @@ class NormalizeTest extends NormalizerTestBase { $entity->getTranslation('en')->set('field_test_entity_reference', array(0 => $translation_values['field_test_entity_reference'])); $entity->save(); - $type_uri = Url::fromUri('base://rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(); - $relation_uri = Url::fromUri('base://rest/relation/entity_test/entity_test/field_test_entity_reference', array('absolute' => TRUE))->toString(); + $type_uri = Url::fromUri('base:rest/type/entity_test/entity_test', array('absolute' => TRUE))->toString(); + $relation_uri = Url::fromUri('base:rest/relation/entity_test/entity_test/field_test_entity_reference', array('absolute' => TRUE))->toString(); $expected_array = array( '_links' => array( diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php index 624eea03b04..4c3775169b6 100644 --- a/core/modules/image/src/Entity/ImageStyle.php +++ b/core/modules/image/src/Entity/ImageStyle.php @@ -225,7 +225,7 @@ class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, Entity // built. if ($clean_urls === FALSE && file_uri_scheme($uri) == 'public' && !file_exists($uri)) { $directory_path = file_stream_wrapper_get_instance_by_uri($uri)->getDirectoryPath(); - return Url::fromUri('base://' . $directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query))->toString(); + return Url::fromUri('base:' . $directory_path . '/' . file_uri_target($uri), array('absolute' => TRUE, 'query' => $token_query))->toString(); } $file_url = file_create_url($uri); diff --git a/core/modules/image/src/Tests/ImageThemeFunctionTest.php b/core/modules/image/src/Tests/ImageThemeFunctionTest.php index 2291b386db3..ad7af4dffc4 100644 --- a/core/modules/image/src/Tests/ImageThemeFunctionTest.php +++ b/core/modules/image/src/Tests/ImageThemeFunctionTest.php @@ -87,7 +87,7 @@ class ImageThemeFunctionTest extends WebTestBase { '#theme' => 'image_formatter', '#image_style' => 'test', '#item' => $entity->image_test, - '#url' => Url::fromUri('base://' . $path), + '#url' => Url::fromUri('base:' . $path), ); // Test using theme_image_formatter() with a NULL value for the alt option. diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php index 1f121ef64fa..a019bc91e54 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/src/Tests/MenuTest.php @@ -116,7 +116,7 @@ class MenuTest extends MenuWebTestBase { // Verify delete link exists and reset link does not exist. $this->drupalGet('admin/structure/menu/manage/' . $this->menu->id()); $this->assertLinkByHref('admin/structure/menu/item/' . $this->items[0]->id() . '/delete'); - $this->assertNoLinkByHref(Url::fromUri('base://admin/structure/menu/link/' . $this->items[0]->getPluginId() . '/reset')->toString()); + $this->assertNoLinkByHref(Url::fromUri('base:admin/structure/menu/link/' . $this->items[0]->getPluginId() . '/reset')->toString()); // Check delete and reset access. $this->drupalGet('admin/structure/menu/item/' . $this->items[0]->id() . '/delete'); $this->assertResponse(200); diff --git a/core/modules/path/src/Controller/PathController.php b/core/modules/path/src/Controller/PathController.php index 63b12f16792..f352de1419d 100644 --- a/core/modules/path/src/Controller/PathController.php +++ b/core/modules/path/src/Controller/PathController.php @@ -86,11 +86,11 @@ class PathController extends ControllerBase { $destination = drupal_get_destination(); foreach ($this->aliasStorage->getAliasesForAdminListing($header, $keys) as $data) { $row = array(); - $row['data']['alias'] = $this->l(Unicode::truncate($data->alias, 50, FALSE, TRUE), Url::fromUri('base://' . $data->source, array( + $row['data']['alias'] = $this->l(Unicode::truncate($data->alias, 50, FALSE, TRUE), Url::fromUri('base:' . $data->source, array( 'path_processing' => TRUE, 'attributes' => array('title' => $data->alias), ))); - $row['data']['source'] = $this->l(Unicode::truncate($data->source, 50, FALSE, TRUE), Url::fromUri('base://' . $data->source, array( + $row['data']['source'] = $this->l(Unicode::truncate($data->source, 50, FALSE, TRUE), Url::fromUri('base:' . $data->source, array( 'alias' => TRUE, 'attributes' => array('title' => $data->source), ))); diff --git a/core/modules/rest/src/LinkManager/RelationLinkManager.php b/core/modules/rest/src/LinkManager/RelationLinkManager.php index 54bec536ae3..38bf4cfcc85 100644 --- a/core/modules/rest/src/LinkManager/RelationLinkManager.php +++ b/core/modules/rest/src/LinkManager/RelationLinkManager.php @@ -54,7 +54,7 @@ class RelationLinkManager implements RelationLinkManagerInterface { * {@inheritdoc} */ public function getRelationUri($entity_type, $bundle, $field_name) { - return $this->urlAssembler->assemble("base://rest/relation/$entity_type/$bundle/$field_name", array('absolute' => TRUE)); + return $this->urlAssembler->assemble("base:rest/relation/$entity_type/$bundle/$field_name", array('absolute' => TRUE)); } /** diff --git a/core/modules/rest/src/LinkManager/TypeLinkManager.php b/core/modules/rest/src/LinkManager/TypeLinkManager.php index 5a7e6034a7d..4160b2b4d78 100644 --- a/core/modules/rest/src/LinkManager/TypeLinkManager.php +++ b/core/modules/rest/src/LinkManager/TypeLinkManager.php @@ -53,7 +53,7 @@ class TypeLinkManager implements TypeLinkManagerInterface { */ public function getTypeUri($entity_type, $bundle) { // @todo Make the base path configurable. - return $this->urlAssembler->assemble("base://rest/type/$entity_type/$bundle", array('absolute' => TRUE)); + return $this->urlAssembler->assemble("base:rest/type/$entity_type/$bundle", array('absolute' => TRUE)); } /** diff --git a/core/modules/rest/src/Tests/NodeTest.php b/core/modules/rest/src/Tests/NodeTest.php index 863cd0435ff..7169102eebd 100644 --- a/core/modules/rest/src/Tests/NodeTest.php +++ b/core/modules/rest/src/Tests/NodeTest.php @@ -70,7 +70,7 @@ class NodeTest extends RESTTestBase { $data = array( '_links' => array( 'type' => array( - 'href' => Url::fromUri('base://rest/type/node/resttest', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/type/node/resttest', array('absolute' => TRUE))->toString(), ), ), 'title' => array( diff --git a/core/modules/serialization/src/Tests/EntityResolverTest.php b/core/modules/serialization/src/Tests/EntityResolverTest.php index e87b69b8723..7d7c00d65a5 100644 --- a/core/modules/serialization/src/Tests/EntityResolverTest.php +++ b/core/modules/serialization/src/Tests/EntityResolverTest.php @@ -63,12 +63,12 @@ class EntityResolverTest extends NormalizerTestBase { $entity->set('field_test_entity_reference', array(array('target_id' => 1))); $entity->save(); - $field_uri = Url::fromUri('base://rest/relation/entity_test_mulrev/entity_test_mulrev/field_test_entity_reference', array('absolute' => TRUE))->toString(); + $field_uri = Url::fromUri('base:rest/relation/entity_test_mulrev/entity_test_mulrev/field_test_entity_reference', array('absolute' => TRUE))->toString(); $data = array( '_links' => array( 'type' => array( - 'href' => Url::fromUri('base://rest/type/entity_test_mulrev/entity_test_mulrev', array('absolute' => TRUE))->toString(), + 'href' => Url::fromUri('base:rest/type/entity_test_mulrev/entity_test_mulrev', array('absolute' => TRUE))->toString(), ), $field_uri => array( array( diff --git a/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php b/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php index fedd64c0a88..e384a3c5a1f 100644 --- a/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php +++ b/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php @@ -77,7 +77,7 @@ class SimpleTestBrowserTest extends WebTestBase { // @see drupal_valid_test_ua() // Not using File API; a potential error must trigger a PHP warning. unlink($this->siteDirectory . '/.htkey'); - $this->drupalGet(Url::fromUri('base://core/install.php', array('external' => TRUE, 'absolute' => TRUE))->toString()); + $this->drupalGet(Url::fromUri('base:core/install.php', array('external' => TRUE, 'absolute' => TRUE))->toString()); $this->assertResponse(403, 'Cannot access install.php.'); } diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index c70c1a63f70..5d84cb9f307 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -40,7 +40,7 @@ function statistics_help($route_name, RouteMatchInterface $route_match) { function statistics_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) { if (!$node->isNew() && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview)) { $build['statistics_content_counter']['#attached']['library'][] = 'statistics/drupal.statistics'; - $settings = array('data' => array('nid' => $node->id()), 'url' => Url::fromUri('base://' . drupal_get_path('module', 'statistics') . '/statistics.php')->toString()); + $settings = array('data' => array('nid' => $node->id()), 'url' => Url::fromUri('base:' . drupal_get_path('module', 'statistics') . '/statistics.php')->toString()); $build['statistics_content_counter']['#attached']['drupalSettings']['statistics'] = $settings; } } diff --git a/core/modules/system/src/Tests/Common/AddFeedTest.php b/core/modules/system/src/Tests/Common/AddFeedTest.php index 4fe5e6f388f..75a20d01f06 100644 --- a/core/modules/system/src/Tests/Common/AddFeedTest.php +++ b/core/modules/system/src/Tests/Common/AddFeedTest.php @@ -23,15 +23,15 @@ class AddFeedTest extends WebTestBase { function testBasicFeedAddNoTitle() { $path = $this->randomMachineName(12); $external_url = 'http://' . $this->randomMachineName(12) . '/' . $this->randomMachineName(12); - $fully_qualified_local_url = Url::fromUri('base://' . $this->randomMachineName(12), array('absolute' => TRUE))->toString(); + $fully_qualified_local_url = Url::fromUri('base:' . $this->randomMachineName(12), array('absolute' => TRUE))->toString(); $path_for_title = $this->randomMachineName(12); $external_for_title = 'http://' . $this->randomMachineName(12) . '/' . $this->randomMachineName(12); - $fully_qualified_for_title = Url::fromUri('base://' . $this->randomMachineName(12), array('absolute' => TRUE))->toString(); + $fully_qualified_for_title = Url::fromUri('base:' . $this->randomMachineName(12), array('absolute' => TRUE))->toString(); $urls = array( 'path without title' => array( - 'url' => Url::fromUri('base://' . $path, array('absolute' => TRUE))->toString(), + 'url' => Url::fromUri('base:' . $path, array('absolute' => TRUE))->toString(), 'title' => '', ), 'external URL without title' => array( @@ -43,7 +43,7 @@ class AddFeedTest extends WebTestBase { 'title' => '', ), 'path with title' => array( - 'url' => Url::fromUri('base://' . $path_for_title, array('absolute' => TRUE))->toString(), + 'url' => Url::fromUri('base:' . $path_for_title, array('absolute' => TRUE))->toString(), 'title' => $this->randomMachineName(12), ), 'external URL with title' => array( diff --git a/core/modules/system/src/Tests/Common/UrlTest.php b/core/modules/system/src/Tests/Common/UrlTest.php index 21ea4322196..eb61b06a171 100644 --- a/core/modules/system/src/Tests/Common/UrlTest.php +++ b/core/modules/system/src/Tests/Common/UrlTest.php @@ -32,12 +32,12 @@ class UrlTest extends WebTestBase { $text = $this->randomMachineName(); $path = ""; $link = _l($text, $path); - $sanitized_path = check_url(Url::fromUri('base://' . $path)->toString()); + $sanitized_path = check_url(Url::fromUri('base:' . $path)->toString()); $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, format_string('XSS attack @path was filtered by _l().', array('@path' => $path))); // Test \Drupal\Core\Url. - $link = Url::fromUri('base://' . $path)->toString(); - $sanitized_path = check_url(Url::fromUri('base://' . $path)->toString()); + $link = Url::fromUri('base:' . $path)->toString(); + $sanitized_path = check_url(Url::fromUri('base:' . $path)->toString()); $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, format_string('XSS attack @path was filtered by #theme', ['@path' => $path])); } diff --git a/core/modules/system/src/Tests/Menu/AssertBreadcrumbTrait.php b/core/modules/system/src/Tests/Menu/AssertBreadcrumbTrait.php index 463ad4e17fc..a9d421aa755 100644 --- a/core/modules/system/src/Tests/Menu/AssertBreadcrumbTrait.php +++ b/core/modules/system/src/Tests/Menu/AssertBreadcrumbTrait.php @@ -71,13 +71,13 @@ trait AssertBreadcrumbTrait { foreach ($trail as $path => $title) { // If the path is empty, generate the path from the route. If // the path does not start with a leading, then run it through - // Url::fromUri('base://')->toString() to get correct the base + // Url::fromUri('base:')->toString() to get correct the base // prepended. if ($path == '') { $url = Url::fromRoute('')->toString(); } elseif ($path[0] != '/') { - $url = Url::fromUri('base://' . $path)->toString(); + $url = Url::fromUri('base:' . $path)->toString(); } else { $url = $path; diff --git a/core/modules/system/src/Tests/Menu/AssertMenuActiveTrailTrait.php b/core/modules/system/src/Tests/Menu/AssertMenuActiveTrailTrait.php index ecf6f4368a0..d217c6640bf 100644 --- a/core/modules/system/src/Tests/Menu/AssertMenuActiveTrailTrait.php +++ b/core/modules/system/src/Tests/Menu/AssertMenuActiveTrailTrait.php @@ -37,7 +37,7 @@ trait AssertMenuActiveTrailTrait { $part_xpath .= 'li[contains(@class, :class)]/a[contains(@href, :href) and contains(text(), :title)]'; $part_args = array( ':class' => 'active-trail', - ':href' => Url::fromUri('base://' . $link_path)->toString(), + ':href' => Url::fromUri('base:' . $link_path)->toString(), ':title' => $link_title, ); $xpath .= $this->buildXPathQuery($part_xpath, $part_args); @@ -57,7 +57,7 @@ trait AssertMenuActiveTrailTrait { $args = array( ':class-trail' => 'active-trail', ':class-active' => 'active', - ':href' => Url::fromUri('base://' . $active_link_path)->toString(), + ':href' => Url::fromUri('base:' . $active_link_path)->toString(), ':title' => $active_link_title, ); $elements = $this->xpath($xpath, $args); diff --git a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php index f1dc18efa69..ed4d35ab949 100644 --- a/core/modules/system/src/Tests/Menu/BreadcrumbTest.php +++ b/core/modules/system/src/Tests/Menu/BreadcrumbTest.php @@ -278,7 +278,7 @@ class BreadcrumbTest extends MenuTestBase { // other than the breadcrumb trail. $elements = $this->xpath('//nav[@id=:menu]/descendant::a[@href=:href]', array( ':menu' => 'block-bartik-tools', - ':href' => Url::fromUri('base://' . $link_path)->toString(), + ':href' => Url::fromUri('base:' . $link_path)->toString(), )); $this->assertTrue(count($elements) == 1, "Link to {$link_path} appears only once."); diff --git a/core/modules/system/src/Tests/Menu/LocalTasksTest.php b/core/modules/system/src/Tests/Menu/LocalTasksTest.php index 37b44d8aad5..ea376d65109 100644 --- a/core/modules/system/src/Tests/Menu/LocalTasksTest.php +++ b/core/modules/system/src/Tests/Menu/LocalTasksTest.php @@ -35,7 +35,7 @@ class LocalTasksTest extends WebTestBase { )); $this->assertTrue(count($elements), 'Local tasks found.'); foreach ($hrefs as $index => $element) { - $expected = Url::fromUri('base://' . $hrefs[$index])->toString(); + $expected = Url::fromUri('base:' . $hrefs[$index])->toString(); $method = ($elements[$index]['href'] == $expected ? 'pass' : 'fail'); $this->{$method}(format_string('Task @number href @value equals @expected.', array( '@number' => $index + 1, diff --git a/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php index abdcff646ff..a96b8e42bf1 100644 --- a/core/modules/system/src/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php @@ -191,7 +191,7 @@ class FunctionsTest extends WebTestBase { $variables['links'] = array( 'a link' => array( 'title' => 'A ', - 'url' => Url::fromUri('base://a/link'), + 'url' => Url::fromUri('base:a/link'), ), 'plain text' => array( 'title' => 'Plain "text"', @@ -215,7 +215,7 @@ class FunctionsTest extends WebTestBase { $expected_links = ''; $expected_links .= '