Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\Core;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Component\Utility\UrlHelper;
|
||||
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
|
@ -232,7 +231,7 @@ class Url {
|
|||
// because these are URI reserved characters that a scheme name may not
|
||||
// start with.
|
||||
if ((strpos($user_input, '/') !== 0) && (strpos($user_input, '#') !== 0) && (strpos($user_input, '?') !== 0)) {
|
||||
throw new \InvalidArgumentException(SafeMarkup::format("The user-entered string @user_input must begin with a '/', '?', or '#'.", ['@user_input' => $user_input]));
|
||||
throw new \InvalidArgumentException("The user-entered string '$user_input' must begin with a '/', '?', or '#'.");
|
||||
}
|
||||
|
||||
// fromUri() requires an absolute URI, so prepend the appropriate scheme
|
||||
|
@ -296,10 +295,10 @@ class Url {
|
|||
public static function fromUri($uri, $options = []) {
|
||||
$uri_parts = parse_url($uri);
|
||||
if ($uri_parts === FALSE) {
|
||||
throw new \InvalidArgumentException(SafeMarkup::format('The URI "@uri" is malformed.', ['@uri' => $uri]));
|
||||
throw new \InvalidArgumentException("The URI '$uri' is malformed.");
|
||||
}
|
||||
if (empty($uri_parts['scheme'])) {
|
||||
throw new \InvalidArgumentException(SafeMarkup::format('The URI "@uri" is invalid. You must use a valid URI scheme.', ['@uri' => $uri]));
|
||||
throw new \InvalidArgumentException("The URI '$uri' is invalid. You must use a valid URI scheme.");
|
||||
}
|
||||
$uri_parts += ['path' => ''];
|
||||
// Discard empty fragment in $options for consistency with parse_url().
|
||||
|
@ -362,7 +361,7 @@ class Url {
|
|||
protected static function fromEntityUri(array $uri_parts, array $options, $uri) {
|
||||
list($entity_type_id, $entity_id) = explode('/', $uri_parts['path'], 2);
|
||||
if ($uri_parts['scheme'] != 'entity' || $entity_id === '') {
|
||||
throw new \InvalidArgumentException(SafeMarkup::format('The entity URI "@uri" is invalid. You must specify the entity id in the URL. e.g., entity:node/1 for loading the canonical path to node entity with id 1.', ['@uri' => $uri]));
|
||||
throw new \InvalidArgumentException("The entity URI '$uri' is invalid. You must specify the entity id in the URL. e.g., entity:node/1 for loading the canonical path to node entity with id 1.");
|
||||
}
|
||||
|
||||
return new static("entity.$entity_type_id.canonical", [$entity_type_id => $entity_id], $options);
|
||||
|
@ -422,13 +421,13 @@ class Url {
|
|||
}
|
||||
else {
|
||||
if ($uri_parts['path'][0] !== '/') {
|
||||
throw new \InvalidArgumentException(SafeMarkup::format('The internal path component "@path" is invalid. Its path component must have a leading slash, e.g. internal:/foo.', ['@path' => $uri_parts['path']]));
|
||||
throw new \InvalidArgumentException("The internal path component '{$uri_parts['path']}' is invalid. Its path component must have a leading slash, e.g. internal:/foo.");
|
||||
}
|
||||
// Remove the leading slash.
|
||||
$uri_parts['path'] = substr($uri_parts['path'], 1);
|
||||
|
||||
if (UrlHelper::isExternal($uri_parts['path'])) {
|
||||
throw new \InvalidArgumentException(SafeMarkup::format('The internal path component "@path" is external. You are not allowed to specify an external URL together with internal:/.', ['@path' => $uri_parts['path']]));
|
||||
throw new \InvalidArgumentException("The internal path component '{$uri_parts['path']}' is external. You are not allowed to specify an external URL together with internal:/.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +461,7 @@ class Url {
|
|||
$route_parts = explode(';', $uri_parts['path'], 2);
|
||||
$route_name = $route_parts[0];
|
||||
if ($route_name === '') {
|
||||
throw new \InvalidArgumentException(SafeMarkup::format('The route URI "@uri" is invalid. You must have a route name in the URI. e.g., route:system.admin', ['@uri' => $uri]));
|
||||
throw new \InvalidArgumentException("The route URI '$uri' is invalid. You must have a route name in the URI. e.g., route:system.admin");
|
||||
}
|
||||
$route_parameters = [];
|
||||
if (!empty($route_parts[1])) {
|
||||
|
@ -732,21 +731,21 @@ class Url {
|
|||
* http://example.com/node/1 depending on the options array, plus any
|
||||
* specified query string or fragment.
|
||||
*
|
||||
* @param bool $collect_cacheability_metadata
|
||||
* @param bool $collect_bubbleable_metadata
|
||||
* (optional) Defaults to FALSE. When TRUE, both the generated URL and its
|
||||
* associated cacheability metadata are returned.
|
||||
* associated bubbleable metadata are returned.
|
||||
*
|
||||
* @return string|\Drupal\Core\GeneratedUrl
|
||||
* A string URL.
|
||||
* When $collect_cacheability_metadata is TRUE, a GeneratedUrl object is
|
||||
* returned, containing the generated URL plus cacheability metadata.
|
||||
* When $collect_bubbleable_metadata is TRUE, a GeneratedUrl object is
|
||||
* returned, containing the generated URL plus bubbleable metadata.
|
||||
*/
|
||||
public function toString($collect_cacheability_metadata = FALSE) {
|
||||
public function toString($collect_bubbleable_metadata = FALSE) {
|
||||
if ($this->unrouted) {
|
||||
return $this->unroutedUrlAssembler()->assemble($this->getUri(), $this->getOptions(), $collect_cacheability_metadata);
|
||||
return $this->unroutedUrlAssembler()->assemble($this->getUri(), $this->getOptions(), $collect_bubbleable_metadata);
|
||||
}
|
||||
|
||||
return $this->urlGenerator()->generateFromRoute($this->getRouteName(), $this->getRouteParameters(), $this->getOptions(), $collect_cacheability_metadata);
|
||||
return $this->urlGenerator()->generateFromRoute($this->getRouteName(), $this->getRouteParameters(), $this->getOptions(), $collect_bubbleable_metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue