Drupal 8  8.0.2
MetadataBubblingUrlGenerator Class Reference
Inheritance diagram for MetadataBubblingUrlGenerator:

Public Member Functions

 __construct (UrlGeneratorInterface $url_generator, RendererInterface $renderer)
 
 setContext (SymfonyRequestContext $context)
 
 getContext ()
 
 getPathFromRoute ($name, $parameters=array())
 
 generate ($name, $parameters=array(), $absolute=FALSE)
 
 generateFromRoute ($name, $parameters=array(), $options=array(), $collect_bubbleable_metadata=FALSE)
 
 supports ($name)
 
 getRouteDebugMessage ($name, array $parameters=array())
 

Protected Member Functions

 bubble (GeneratedUrl $generated_url, array $options=[])
 

Protected Attributes

 $urlGenerator
 
 $renderer
 

Detailed Description

Decorator for the URL generator, which bubbles bubbleable URL metadata.

Implements a decorator for the URL generator that allows to automatically collect and bubble up bubbleable metadata associated with URLs due to outbound path and route processing. This approach helps keeping the render and the routing subsystems decoupled.

See Also

Constructor & Destructor Documentation

__construct ( UrlGeneratorInterface  $url_generator,
RendererInterface  $renderer 
)

Constructs a new bubbling URL generator service.

Parameters
\Drupal\Core\Routing\UrlGeneratorInterface$url_generatorThe non-bubbling URL generator.
\Drupal\Core\Render\RendererInterface$rendererThe renderer.

References Drupal\urlGenerator().

Here is the call graph for this function:

Member Function Documentation

bubble ( GeneratedUrl  $generated_url,
array  $options = [] 
)
protected

Bubbles the bubbleable metadata to the current render context.

Parameters
\Drupal\Core\GeneratedUrl$generated_urlThe generated URL whose bubbleable metadata to bubble.
array$options(optional) The URL options. Defaults to none.

References BubbleableMetadata\applyTo().

Referenced by MetadataBubblingUrlGenerator\generate(), and MetadataBubblingUrlGenerator\generateFromRoute().

Here is the call graph for this function:

Here is the caller graph for this function:

generate (   $name,
  $parameters = array(),
  $absolute = FALSE 
)

{}

References MetadataBubblingUrlGenerator\bubble(), and MetadataBubblingUrlGenerator\generateFromRoute().

Here is the call graph for this function:

generateFromRoute (   $name,
  $parameters = array(),
  $options = array(),
  $collect_bubbleable_metadata = FALSE 
)

{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.

Parameters
string | \Symfony\Component\Routing\Route$nameThe route name or a route object.
array$parametersAn associative array of parameter names and values.
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.
  • 'language': An optional language object used to look up the alias for the URL. If $options['language'] is omitted, it defaults to the current language for the language type LanguageInterface::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.
  • 'base_url': Only used internally by a path processor, for example, 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.
bool$collect_bubbleable_metadata(optional) Defaults to FALSE. When TRUE, both the generated URL and its associated bubbleable metadata are returned.
Returns
string| The generated URL for the given route. When $collect_bubbleable_metadata is TRUE, a GeneratedUrl object is returned, containing the generated URL plus bubbleable metadata.
Exceptions
\Symfony\Component\Routing\Exception\RouteNotFoundExceptionThrown when the named route does not exist.
\Symfony\Component\Routing\Exception\MissingMandatoryParametersExceptionThrown when some parameters are missing that are mandatory for the route.
\Symfony\Component\Routing\Exception\InvalidParameterExceptionThrown when a parameter value for a placeholder is not correct because it does not match the requirement.
}

Implements UrlGeneratorInterface.

References MetadataBubblingUrlGenerator\bubble(), and Drupal\urlGenerator().

Referenced by MetadataBubblingUrlGenerator\generate().

Here is the call graph for this function:

Here is the caller graph for this function:

getContext ( )

{}

References Drupal\urlGenerator().

Here is the call graph for this function:

getPathFromRoute (   $name,
  $parameters = array() 
)

{Gets the internal path (system path) for a route.

Parameters
string | \Symfony\Component\Routing\Route$nameThe route name or a route object.
array$parametersAn array of parameters as passed to ::generate().
Returns
string The internal Drupal path corresponding to the route.
}

Implements UrlGeneratorInterface.

References Drupal\urlGenerator().

Here is the call graph for this function:

getRouteDebugMessage (   $name,
array  $parameters = array() 
)

{}

References Drupal\urlGenerator().

Here is the call graph for this function:

setContext ( SymfonyRequestContext  $context)

{}

References Drupal\urlGenerator().

Here is the call graph for this function:

supports (   $name)

{}

References Drupal\urlGenerator().

Here is the call graph for this function:


The documentation for this class was generated from the following file: