Commit 2132c179 authored by webchick's avatar webchick

Issue #2057155 by pwolanin, dawehner: Add a generateFromRoute() method on the...

Issue #2057155 by pwolanin, dawehner: Add a generateFromRoute() method on the url generator to accept options like url().
parent fa967340
......@@ -448,7 +448,6 @@ function drupal_get_query_parameters(array $query = NULL, array $exclude = array
/**
* Parses an array into a valid, rawurlencoded query string.
*
* @see \Drupal\Core\Routing\PathBasedGeneratorInterface::httpBuildQuery()
* @see drupal_get_query_parameters()
* @deprecated as of Drupal 8.0. Use Url::buildQuery() instead.
* @ingroup php_wrappers
......@@ -1192,7 +1191,7 @@ function datetime_default_format_type() {
* When creating links in modules, consider whether l() could be a better
* alternative than url().
*
* @see \Drupal\Core\Routing\PathBasedGeneratorInterface::generateFromPath().
* @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromPath().
*/
function url($path = NULL, array $options = array()) {
$generator = Drupal::urlGenerator();
......
......@@ -364,7 +364,7 @@ public static function token() {
/**
* Returns the url generator service.
*
* @return \Drupal\Core\Routing\PathBasedGeneratorInterface
* @return \Drupal\Core\Routing\UrlGeneratorInterface
* The url generator service.
*/
public static function urlGenerator() {
......
......@@ -114,7 +114,7 @@ protected function moduleHandler() {
/**
* Returns the url generator service.
*
* @return \Drupal\Core\Routing\PathBasedGeneratorInterface
* @return \Drupal\Core\Routing\UrlGeneratorInterface
* The url generator service.
*/
protected function urlGenerator() {
......
......@@ -9,7 +9,6 @@
use Drupal\Core\CacheDecorator\AliasManagerCacheDecorator;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
......
......@@ -7,7 +7,7 @@
namespace Drupal\Core\EventSubscriber;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
......@@ -22,17 +22,17 @@ class RedirectResponseSubscriber implements EventSubscriberInterface {
/**
* The url generator service.
*
* @var \Drupal\Core\Routing\PathBasedGeneratorInterface
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
protected $urlGenerator;
/**
* Constructs a RedirectResponseSubscriber object.
*
* @param \Drupal\Core\Routing\PathBasedGeneratorInterface $url_generator
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The url generator service.
*/
public function __construct(PathBasedGeneratorInterface $url_generator) {
public function __construct(UrlGeneratorInterface $url_generator) {
$this->urlGenerator = $url_generator;
}
......
......@@ -7,7 +7,6 @@
namespace Drupal\Core\Routing;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
......@@ -23,9 +22,12 @@ public function __construct() {
}
/**
* Overrides Drupal\Core\Routing\UrlGenerator::generate();
* {@inheritdoc}
*
* generate(), generateFromRoute(), and getPathFromRoute() all call this
* protected method.
*/
public function generate($name, $parameters = array(), $absolute = FALSE) {
protected function getRoute($name) {
throw new RouteNotFoundException();
}
......
......@@ -23,7 +23,7 @@
/**
* A Generator creates URL strings based on a specified route.
*/
class UrlGenerator extends ProviderBasedGenerator implements PathBasedGeneratorInterface {
class UrlGenerator extends ProviderBasedGenerator implements UrlGeneratorInterface {
/**
* A request object.
......@@ -87,7 +87,7 @@ public function __construct(RouteProviderInterface $provider, OutboundPathProces
}
/**
* Implements \Drupal\Core\Routing\PathBasedGeneratorInterface::setRequest().
* {@inheritdoc}
*/
public function setRequest(Request $request) {
$this->request = $request;
......@@ -108,7 +108,7 @@ public function setRequest(Request $request) {
* {@inheritdoc}
*/
public function getPathFromRoute($name, $parameters = array()) {
$route = $this->getRoute($name, $parameters);
$route = $this->getRoute($name);
$path = $this->getInternalPathFromRoute($route, $parameters);
// Router-based paths may have a querystring on them but Drupal paths may
// not have one, so remove any ? and anything after it. For generate() this
......@@ -157,18 +157,41 @@ protected function getInternalPathFromRoute(SymfonyRoute $route, $parameters = a
* {@inheritdoc}
*/
public function generate($name, $parameters = array(), $absolute = FALSE) {
$route = $this->getRoute($name, $parameters);
$path = $this->getInternalPathFromRoute($route, $parameters);
$path = $this->processPath($path);
$options['absolute'] = $absolute;
return $this->generateFromRoute($name, $parameters, $options);
}
/**
* {@inheritdoc}
*/
public function generateFromRoute($name, $parameters = array(), $options = array()) {
$absolute = !empty($options['absolute']);
$route = $this->getRoute($name);
// Symfony adds any parameters that are not path slugs as query strings.
if (isset($options['query']) && is_array($options['query'])) {
$parameters = (array) $parameters + $options['query'];
}
$path = $this->getInternalPathFromRoute($route, $parameters);
$path = $this->processPath($path, $options);
$fragment = '';
if (isset($options['fragment'])) {
if (($fragment = trim($options['fragment'])) != '') {
$fragment = '#' . $fragment;
}
}
$base_url = $this->context->getBaseUrl();
if (!$absolute || !$host = $this->context->getHost()) {
return $base_url . $path;
return $base_url . $path . $fragment;
}
// Prepare an absolute URL by getting the correct scheme, host and port from
// the request context.
$scheme = $this->context->getScheme();
if (isset($options['https']) && $this->mixedModeSessions) {
$scheme = $options['https'] ? 'https' : 'http';
}
else {
$scheme = $this->context->getScheme();
}
$scheme_req = $route->getRequirement('_scheme');
if (isset($scheme_req) && ($req = strtolower($scheme_req)) && $scheme !== $req) {
$scheme = $req;
......@@ -179,68 +202,11 @@ public function generate($name, $parameters = array(), $absolute = FALSE) {
} elseif ('https' === $scheme && 443 != $this->context->getHttpsPort()) {
$port = ':' . $this->context->getHttpsPort();
}
return $scheme . '://' . $host . $port . $base_url . $path;
return $scheme . '://' . $host . $port . $base_url . $path . $fragment;
}
/**
* Implements \Drupal\Core\Routing\PathBasedGeneratorInterface::generateFromPath().
*
* @param $path
* (optional) The internal path or external URL being linked to, such as
* "node/34" or "http://example.com/foo". The default value is equivalent to
* passing in '<front>'. A few notes:
* - If you provide a full URL, it will be considered an external URL.
* - If you provide only the path (e.g. "node/34"), it will be
* considered an internal link. In this case, it should be a system URL,
* and it will be replaced with the alias, if one exists. Additional query
* arguments for internal paths must be supplied in $options['query'], not
* included in $path.
* - If you provide an internal path and $options['alias'] is set to TRUE, the
* path is assumed already to be the correct path alias, and the alias is
* not looked up.
* - The special string '<front>' generates a link to the site's base URL.
* - If your external URL contains a query (e.g. http://example.com/foo?a=b),
* then you can either URL encode the query keys and values yourself and
* include them in $path, or use $options['query'] to let this method
* URL encode them.
*
* @param $options
* (optional) An associative array of additional options, with the following
* elements:
* - 'query': An array of query key/value-pairs (without any URL-encoding) to
* append to the URL.
* - 'fragment': A fragment identifier (named anchor) to append to the URL.
* Do not include the leading '#' character.
* - 'absolute': Defaults to FALSE. Whether to force the output to be an
* absolute link (beginning with http:). Useful for links that will be
* displayed outside the site, such as in an RSS feed.
* - 'alias': Defaults to FALSE. Whether the given path is a URL alias
* already.
* - 'external': Whether the given path is an external URL.
* - 'language': An optional language object. If the path being linked to is
* internal to the site, $options['language'] is used to look up the alias
* for the URL. If $options['language'] is omitted, the language will be
* obtained from language(Language::TYPE_URL).
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but HTTPS can
* only be enforced when the variable 'https' is set to TRUE.
* - 'base_url': Only used internally, to modify the base URL when a language
* dependent URL requires so.
* - 'prefix': Only used internally, to modify the path when a language
* dependent URL requires so.
* - 'script': Added to the URL between the base path and the path prefix.
* Defaults to empty string when clean URLs are in effect, and to
* 'index.php/' when they are not.
* - 'entity_type': The entity type of the object that called url(). Only
* set if url() is invoked by Drupal\Core\Entity\Entity::uri().
* - 'entity': The entity object (such as a node) for which the URL is being
* generated. Only set if url() is invoked by Drupal\Core\Entity\Entity::uri().
*
* @return
* A string containing a URL to the given path.
*
* @throws \Drupal\Core\Routing\GeneratorNotInitializedException.
* {@inheritdoc}
*/
public function generateFromPath($path = NULL, $options = array()) {
......@@ -329,21 +295,21 @@ public function generateFromPath($path = NULL, $options = array()) {
}
/**
* Implements \Drupal\Core\Routing\PathBasedGeneratorInterface::setBaseUrl().
* {@inheritdoc}
*/
public function setBaseUrl($url) {
$this->baseUrl = $url;
}
/**
* Implements \Drupal\Core\Routing\PathBasedGeneratorInterface::setBasePath().
* {@inheritdoc}
*/
public function setBasePath($path) {
$this->basePath = $path;
}
/**
* Implements \Drupal\Core\Routing\PathBasedGeneratorInterface::setScriptPath().
* {@inheritdoc}
*/
public function setScriptPath($path) {
$this->scriptPath = $path;
......@@ -381,13 +347,10 @@ protected function initialized() {
}
/**
* Find the route using the provided route name (and parameters).
* Find the route using the provided route name.
*
* @param string $name
* The route name to fetch
* @param array $parameters
* The parameters as they are passed to the UrlGeneratorInterface::generate
* call.
*
* @return \Symfony\Component\Routing\Route
* The found route.
......@@ -397,11 +360,11 @@ protected function initialized() {
*
* @see \Drupal\Core\Routing\RouteProviderInterface
*/
protected function getRoute($name, $parameters) {
protected function getRoute($name) {
if ($name instanceof SymfonyRoute) {
$route = $name;
}
elseif (NULL === $route = $this->provider->getRouteByName($name, $parameters)) {
elseif (NULL === $route = $this->provider->getRouteByName($name)) {
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));
}
return $route;
......
......@@ -2,30 +2,83 @@
/**
* @file
* Contains Drupal\Core\Routing\PathBasedGeneratorInterface.
* Contains \Drupal\Core\Routing\UrlGeneratorInterface.
*/
namespace Drupal\Core\Routing;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\VersatileGeneratorInterface;
/**
* Defines an interface for generating a url from a path as opposed to a route.
* Defines an interface for generating a url from a route or system path.
*
* Provides additional methods and options not present in the base interface.
*/
interface PathBasedGeneratorInterface {
interface UrlGeneratorInterface extends VersatileGeneratorInterface {
/**
* Generates an internal or external URL.
*
* @param $path
* @param string $path
* (optional) The internal path or external URL being linked to, such as
* "node/34" or "http://example.com/foo".
*
* @param $options
* (optional) An associative array of additional options.
* "node/34" or "http://example.com/foo". The default value is equivalent to
* passing in '<front>'. A few notes:
* - If you provide a full URL, it will be considered an external URL.
* - If you provide only the path (e.g. "node/34"), it will be
* considered an internal link. In this case, it should be a system URL,
* and it will be replaced with the alias, if one exists. Additional query
* arguments for internal paths must be supplied in $options['query'], not
* included in $path.
* - If you provide an internal path and $options['alias'] is set to TRUE, the
* path is assumed already to be the correct path alias, and the alias is
* not looked up.
* - The special string '<front>' generates a link to the site's base URL.
* - If your external URL contains a query (e.g. http://example.com/foo?a=b),
* then you can either URL encode the query keys and values yourself and
* include them in $path, or use $options['query'] to let this method
* URL encode them.
*
* @param array $options
* (optional) An associative array of additional options, with the following
* elements:
* - 'query': An array of query key/value-pairs (without any URL-encoding) to
* append to the URL.
* - 'fragment': A fragment identifier (named anchor) to append to the URL.
* Do not include the leading '#' character.
* - 'absolute': Defaults to FALSE. Whether to force the output to be an
* absolute link (beginning with http:). Useful for links that will be
* displayed outside the site, such as in an RSS feed.
* - 'alias': Defaults to FALSE. Whether the given path is a URL alias
* already.
* - 'external': Whether the given path is an external URL.
* - 'language': An optional language object. If the path being linked to is
* internal to the site, $options['language'] is used to look up the alias
* for the URL. If $options['language'] is omitted, the language will be
* obtained from language(Language::TYPE_URL).
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but HTTPS can
* only be enforced when the variable 'https' is set to TRUE.
* - 'base_url': Only used internally, to modify the base URL when a language
* dependent URL requires so.
* - 'prefix': Only used internally, to modify the path when a language
* dependent URL requires so.
* - 'script': Added to the URL between the base path and the path prefix.
* Defaults to empty string when clean URLs are in effect, and to
* 'index.php/' when they are not.
* - 'entity_type': The entity type of the object that called url(). Only
* set if url() is invoked by Drupal\Core\Entity\Entity::uri().
* - 'entity': The entity object (such as a node) for which the URL is being
* generated. Only set if url() is invoked by Drupal\Core\Entity\Entity::uri().
*
* @return
* A string containing a URL to the given path.
*
* @throws \Drupal\Core\Routing\GeneratorNotInitializedException.
*
* @deprecated since version 8.0
* System paths should not be used - use route names and parameters.
*/
public function generateFromPath($path = NULL, $options = array());
......@@ -40,9 +93,51 @@ public function generateFromPath($path = NULL, $options = array());
*
* @return string
* The internal Drupal path corresponding to the route.
*
* @deprecated since version 8.0
* System paths should not be used - use route names and parameters.
*/
public function getPathFromRoute($name, $parameters = array());
/**
* Generates a URL or path for a specific route based on the given parameters.
*
* Parameters that reference placeholders in the route pattern will be
* substituted for them in the pattern. Extra params are added as query
* strings to the URL.
*
* @param string $name
* The name of the route
* @param array $parameters
* An associative array of parameter names and values.
* @param array $options
* (optional) An associative array of additional options, with the following
* elements:
* - 'query': An array of query key/value-pairs (without any URL-encoding)
* to append to the URL. Merged with the parameters array.
* - 'fragment': A fragment identifier (named anchor) to append to the URL.
* Do not include the leading '#' character.
* - 'absolute': Defaults to FALSE. Whether to force the output to be an
* absolute link (beginning with http:). Useful for links that will be
* displayed outside the site, such as in an RSS feed.
* - 'language': An optional language object used to look up the alias
* for the URL. If $options['language'] is omitted, the language will be
* obtained from language(Language::TYPE_URL).
* - 'https': Whether this URL should point to a secure location. If not
* defined, the current scheme is used, so the user stays on HTTP or HTTPS
* respectively. if mixed mode sessions are permitted, TRUE enforces HTTPS
* and FALSE enforces HTTP.
*
* @return string
* The generated URL for the given route.
*
* @throws RouteNotFoundException If the named route doesn't exist
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
* it does not match the requirement
*/
public function generateFromRoute($name, $parameters = array(), $options = array());
/**
* Sets the $request property.
*
......
......@@ -11,7 +11,7 @@
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Action\ConfigurableActionBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
......@@ -38,7 +38,7 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi
/**
* The url generator service.
*
* @var \Drupal\Core\Routing\PathBasedGeneratorInterface
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
protected $urlGenerator;
......@@ -53,10 +53,10 @@ class GotoAction extends ConfigurableActionBase implements ContainerFactoryPlugi
* The plugin implementation definition.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* The tempstore factory.
* @param \Drupal\Core\Routing\PathBasedGeneratorInterface $url_generator
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The url generator service.
*/
public function __construct(array $configuration, $plugin_id, array $plugin_definition, EventDispatcherInterface $dispatcher, PathBasedGeneratorInterface $url_generator) {
public function __construct(array $configuration, $plugin_id, array $plugin_definition, EventDispatcherInterface $dispatcher, UrlGeneratorInterface $url_generator) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->dispatcher = $dispatcher;
......
......@@ -13,7 +13,7 @@
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityManager;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
......@@ -55,7 +55,7 @@ class AggregatorController implements ControllerInterface {
/**
* The url generator.
*
* @var \Drupal\Core\Routing\PathBasedGeneratorInterface
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
protected $urlGenerator;
......@@ -73,7 +73,7 @@ class AggregatorController implements ControllerInterface {
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(EntityManager $entity_manager, Connection $database, ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, PathBasedGeneratorInterface $url_generator) {
public function __construct(EntityManager $entity_manager, Connection $database, ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, UrlGeneratorInterface $url_generator) {
$this->entityManager = $entity_manager;
$this->database = $database;
$this->configFactory = $config_factory;
......
......@@ -10,7 +10,7 @@
use Drupal\comment\CommentInterface;
use Drupal\comment\Entity\Comment;
use Drupal\Core\Controller\ControllerInterface;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
......@@ -28,7 +28,7 @@ class CommentController implements ControllerInterface {
/**
* The url generator service.
*
* @var \Drupal\Core\Routing\PathBasedGeneratorInterface
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
protected $urlGenerator;
......@@ -42,12 +42,12 @@ class CommentController implements ControllerInterface {
/**
* Constructs a CommentController object.
*
* @param \Drupal\Core\Routing\PathBasedGeneratorInterface $url_generator
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The url generator service.
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $httpKernel
* HTTP kernel to handle requests.
*/
public function __construct(PathBasedGeneratorInterface $url_generator, HttpKernelInterface $httpKernel) {
public function __construct(UrlGeneratorInterface $url_generator, HttpKernelInterface $httpKernel) {
$this->urlGenerator = $url_generator;
$this->httpKernel = $httpKernel;
}
......
......@@ -15,7 +15,7 @@
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\ConfigException;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -65,7 +65,7 @@ class ConfigSync extends FormBase {
/**
* URL generator service.
*
* @var \Drupal\Core\Routing\PathBasedGeneratorInterface
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
protected $urlGenerator;
......@@ -84,10 +84,10 @@ class ConfigSync extends FormBase {
* Configuration object factory.
* @param \Drupal\Core\Entity\EntityManager $entity_manager
* Entity manager.
* @param \Drupal\Core\Routing\PathBasedGeneratorInterface $url_generator
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The url generator service.
*/
public function __construct(StorageInterface $sourceStorage, StorageInterface $targetStorage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigFactory $config_factory, EntityManager $entity_manager, PathBasedGeneratorInterface $url_generator) {
public function __construct(StorageInterface $sourceStorage, StorageInterface $targetStorage, LockBackendInterface $lock, EventDispatcherInterface $event_dispatcher, ConfigFactory $config_factory, EntityManager $entity_manager, UrlGeneratorInterface $url_generator) {
$this->sourceStorage = $sourceStorage;
$this->targetStorage = $targetStorage;
$this->lock = $lock;
......
......@@ -12,7 +12,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Drupal\Core\StringTranslation\Translator\TranslatorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -24,7 +24,7 @@ class ImageStyleListController extends ConfigEntityListController implements Ent
/**
* The URL generator.
*
* @var \Drupal\Core\Routing\PathBasedGeneratorInterface
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
protected $urlGenerator;
......@@ -46,12 +46,12 @@ class ImageStyleListController extends ConfigEntityListController implements Ent
* The image style entity storage controller class.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke hooks on.
* @param \Drupal\Core\Routing\PathBasedGeneratorInterface $url_generator
* @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
* The URL generator.
* @param \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translator
* The translation manager.
*/
public function __construct($entity_type, array $entity_info, EntityStorageControllerInterface $image_style_storage, ModuleHandlerInterface $module_handler, PathBasedGeneratorInterface $url_generator, TranslatorInterface $translator) {
public function __construct($entity_type, array $entity_info, EntityStorageControllerInterface $image_style_storage, ModuleHandlerInterface $module_handler, UrlGeneratorInterface $url_generator, TranslatorInterface $translator) {
parent::__construct($entity_type, $entity_info, $image_style_storage, $module_handler);
$this->urlGenerator = $url_generator;
$this->translator = $translator;
......
......@@ -7,7 +7,7 @@
namespace Drupal\locale\Controller;
use Drupal\Core\Controller\ControllerInterface;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
......@@ -29,7 +29,7 @@ class LocaleController implements ControllerInterface {
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(ModuleHandlerInterface $module_handler, PathBasedGeneratorInterface $url_generator) {
public function __construct(ModuleHandlerInterface $module_handler, UrlGeneratorInterface $url_generator) {
$this->moduleHandler = $module_handler;
$this->urlGenerator = $url_generator;
}
......
......@@ -9,9 +9,8 @@
use Drupal\Core\Entity\EntityNGConfirmFormBase;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Routing\PathBasedGeneratorInterface;
use Drupal\Core\Routing\UrlGeneratorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
/**
* Provides a form for deleting a node.
......@@ -21,7 +20,7 @@ class NodeDeleteForm extends EntityNGConfirmFormBase {
/**
* The URL generator.
*
* @var \Drupal\Core\Routing\PathBasedGeneratorInterface
* @var \Drupal\Core\Routing\UrlGeneratorInterface
*/
protected $urlGenerator;
......@@ -35,12 +34,12 @@ class NodeDeleteForm extends EntityNGConfirmFormBase {
/**