class NullGenerator in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Routing/NullGenerator.php \Drupal\Core\Routing\NullGenerator
No-op implementation of a Url Generator, needed for backward compatibility.
Hierarchy
- class \Drupal\Core\Routing\UrlGenerator implements UrlGeneratorInterface
- class \Drupal\Core\Routing\NullGenerator
Expanded class hierarchy of NullGenerator
File
- core/
lib/ Drupal/ Core/ Routing/ NullGenerator.php, line 19 - Contains \Drupal\Core\Routing\NullGenerator.
Namespace
Drupal\Core\RoutingView source
class NullGenerator extends UrlGenerator {
/**
* Override the parent constructor.
*
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* The request stack.
*/
public function __construct(RequestStack $request_stack) {
$this->requestStack = $request_stack;
$this->context = new RequestContext();
}
/**
* {@inheritdoc}
*
* generate(), generateFromRoute(), and getPathFromRoute() all call this
* protected method.
*/
protected function getRoute($name) {
if ($name === '<front>') {
return new Route('/');
}
elseif ($name === '<current>') {
return new Route($this->requestStack
->getCurrentRequest()
->getPathInfo());
}
elseif ($name === '<none>') {
return new Route('');
}
throw new RouteNotFoundException();
}
/**
* {@inheritdoc}
*/
protected function processRoute($name, Route $route, array &$parameters, BubbleableMetadata $bubbleable_metadata = NULL) {
}
/**
* {@inheritdoc}
*/
protected function getInternalPathFromRoute($name, Route $route, $parameters = array(), $query_params = array()) {
return $route
->getPath();
}
/**
* {@inheritdoc}
*/
public function setContext(SymfonyRequestContext $context) {
}
/**
* {@inheritdoc}
*/
public function getContext() {
}
/**
* {@inheritdoc}
*/
protected function processPath($path, &$options = array(), BubbleableMetadata $bubbleable_metadata = NULL) {
return $path;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NullGenerator:: |
public | function |
Gets the request context. Overrides UrlGenerator:: |
|
NullGenerator:: |
protected | function |
Gets the path of a route. Overrides UrlGenerator:: |
|
NullGenerator:: |
protected | function |
generate(), generateFromRoute(), and getPathFromRoute() all call this
protected method. Overrides UrlGenerator:: |
|
NullGenerator:: |
protected | function |
Passes the path to a processor manager to allow alterations. Overrides UrlGenerator:: |
|
NullGenerator:: |
protected | function |
Passes the route to the processor manager for altering before compilation. Overrides UrlGenerator:: |
|
NullGenerator:: |
public | function |
Sets the request context. Overrides UrlGenerator:: |
|
NullGenerator:: |
public | function |
Override the parent constructor. Overrides UrlGenerator:: |
|
UrlGenerator:: |
protected | property | ||
UrlGenerator:: |
protected | property | Overrides characters that will not be percent-encoded in the path segment. | |
UrlGenerator:: |
protected | property | The path processor to convert the system path to one suitable for urls. | |
UrlGenerator:: |
protected | property | A request stack object. | |
UrlGenerator:: |
protected | property | The route processor. | |
UrlGenerator:: |
protected | function | Substitute the route parameters into the route path. | |
UrlGenerator:: |
public | function |
Generates a URL or path for a specific route based on the given parameters. Overrides UrlGeneratorInterface:: |
|
UrlGenerator:: |
public | function |
Generates a URL or path for a specific route based on the given parameters. Overrides UrlGeneratorInterface:: |
|
UrlGenerator:: |
public | function |
Gets the internal path (system path) for a route. Overrides UrlGeneratorInterface:: |
|
UrlGenerator:: |
public | function |
Convert a route identifier (name, content object etc) into a string
usable for logging and other debug/error messages Overrides VersatileGeneratorInterface:: |
|
UrlGenerator:: |
public | function | ||
UrlGenerator:: |
public | function | ||
UrlGenerator:: |
public | function |
Whether this generator supports the supplied $name. Overrides VersatileGeneratorInterface:: |
|
UrlGeneratorInterface:: |
constant | Generates an absolute path, e.g. "/dir/file". | ||
UrlGeneratorInterface:: |
constant | Generates an absolute URL, e.g. "http://example.com/dir/file". | ||
UrlGeneratorInterface:: |
constant | Generates a network path, e.g. "//example.com/dir/file". Such reference reuses the current scheme but specifies the host. | ||
UrlGeneratorInterface:: |
constant | Generates a relative path based on the current request path, e.g. "../parent-file". |