ExtbasePluginEnhancer extends PluginEnhancer

Allows to have a plugin with multiple controllers + actions for one specific plugin that has a namespace.

A typical configuration looks like this:

routeEnhancers: BlogExample: type: Extbase extension: BlogExample plugin: Pi1 routes: - { routePath: '/blog/{page}', _controller: 'Blog::list', _arguments: {'page': '@widget_0/currentPage'} } - { routePath: '/blog/{slug}', _controller: 'Blog::detail' } requirements: page: '[0-9]+' slug: '.*'

Table of Contents

Properties

$aspects  : array<string|int, AspectInterface>
$configuration  : array<string|int, mixed>
$namespace  : string
$routesOfPlugin  : array<string|int, mixed>
$variableProcessor  : VariableProcessor|null

Methods

__construct()  : mixed
buildResult()  : PageArguments
enhanceForGeneration()  : void
Extends route collection with routes that are relevant for given parameters. Used during URL generation.
enhanceForMatching()  : void
Extends route collection with all routes. Used during URL resolving.
getAspects()  : array<string|int, AspectInterface>
inflateParameters()  : array<string|int, mixed>
A route has matched the controller/action combination, so ensure that these properties are set to tx_blogexample_pi1[controller] and tx_blogexample_pi1[action].
setAspects()  : void
applyControllerActionValues()  : mixed
Add controller and action parameters so they can be used later-on.
applyRequirements()  : mixed
applyRouteAspects()  : mixed
applyStaticVariables()  : void
Applies variables that are considered static (not having `&cHash=...` applied), without having the demand to define a custom `StaticMappableAspectInterface` to fake the behavior.
defineValuesByAspect()  : array<string|int, mixed>
Define items having an aspect definition in case they are not defined with a given $targetValue in target $targetValue array.
deflateParameters()  : array<string|int, mixed>
filterValuesByPathVariables()  : array<string|int, mixed>
Only keeps values that actually have been used as variables in route path.
getVariableProcessor()  : VariableProcessor
getVariant()  : Route
Builds a variant of a route based on the given configuration.
hasControllerActionValues()  : bool
Check if action and controller are not empty.
modifyRoutePath()  : string
Modify the route path to add the variable names with the aspects, e.g.
overrideValuesByAspect()  : array<string|int, mixed>
Overrides items having an aspect definition with a given $overrideValue in target $targetValue array.
resolveType()  : string
Retrieves type from processed route and modifies remaining query parameters.
verifyRequiredParameters()  : bool
Check if controller+action combination matches

Properties

$configuration

protected array<string|int, mixed> $configuration

$routesOfPlugin

protected array<string|int, mixed> $routesOfPlugin

Methods

__construct()

public __construct(array<string|int, mixed> $configuration) : mixed
Parameters
$configuration : array<string|int, mixed>

buildResult()

public buildResult(Route $route, array<string|int, mixed> $results[, array<string|int, mixed> $remainingQueryParameters = [] ]) : PageArguments
Parameters
$route : Route
$results : array<string|int, mixed>
$remainingQueryParameters : array<string|int, mixed> = []
Return values
PageArguments

enhanceForGeneration()

Extends route collection with routes that are relevant for given parameters. Used during URL generation.

public enhanceForGeneration(RouteCollection $collection, array<string|int, mixed> $originalParameters) : void
Parameters
$collection : RouteCollection
$originalParameters : array<string|int, mixed>

enhanceForMatching()

Extends route collection with all routes. Used during URL resolving.

public enhanceForMatching(RouteCollection $collection) : void
Parameters
$collection : RouteCollection

inflateParameters()

A route has matched the controller/action combination, so ensure that these properties are set to tx_blogexample_pi1[controller] and tx_blogexample_pi1[action].

public inflateParameters(array<string|int, mixed> $parameters[, array<string|int, mixed> $internals = [] ]) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>

Actual parameter payload to be used

$internals : array<string|int, mixed> = []

Internal instructions (_route, _controller, ...)

Return values
array<string|int, mixed>

setAspects()

public setAspects(array<string|int, mixed> $aspects) : void
Parameters
$aspects : array<string|int, mixed>

applyControllerActionValues()

Add controller and action parameters so they can be used later-on.

protected applyControllerActionValues(string $controllerActionValue, array<string|int, mixed> &$target[, bool $tryUpdate = false ]) : mixed
Parameters
$controllerActionValue : string
$target : array<string|int, mixed>

Reference to target array to be modified

$tryUpdate : bool = false

Try updating action value - but only if controller value matches

applyRequirements()

protected applyRequirements(Route $route, array<string|int, mixed> $requirements[, string|null $namespace = null ]) : mixed
Parameters
$route : Route
$requirements : array<string|int, mixed>
$namespace : string|null = null

applyRouteAspects()

protected applyRouteAspects(Route $route, array<string|int, AspectInterface$aspects[, string|null $namespace = null ]) : mixed
Parameters
$route : Route
$aspects : array<string|int, AspectInterface>
$namespace : string|null = null

applyStaticVariables()

Applies variables that are considered static (not having `&cHash=...` applied), without having the demand to define a custom `StaticMappableAspectInterface` to fake the behavior.

protected applyStaticVariables(Route $route, array<non-empty-string, bool> $staticVariables[, string|null $namespace = null ]) : void

However:

  • in case there's an aspect defined for a variable, it will be skipped (aspects take precedence)
  • in case not requirement is defined for a variable, it will be skipped (avoiding weak definitions)
Parameters
$route : Route
$staticVariables : array<non-empty-string, bool>

option values

$namespace : string|null = null

defineValuesByAspect()

Define items having an aspect definition in case they are not defined with a given $targetValue in target $targetValue array.

protected defineValuesByAspect(Route $route, array<string|int, mixed> $values, string $targetValue) : array<string|int, mixed>
Parameters
$route : Route
$values : array<string|int, mixed>
$targetValue : string
Return values
array<string|int, mixed>

deflateParameters()

protected deflateParameters(Route $route, array<string|int, mixed> $parameters) : array<string|int, mixed>
Parameters
$route : Route
$parameters : array<string|int, mixed>
Return values
array<string|int, mixed>

filterValuesByPathVariables()

Only keeps values that actually have been used as variables in route path.

protected filterValuesByPathVariables(Route $route, array<string|int, mixed> $values) : array<string|int, mixed>
  • routePath: '/list/{page}' ('page' used as variable in route path)
  • values: ['entity' => 'entity...', 'page' => 'page...', 'other' => 'other...']
  • result: ['page' => 'page...']
Parameters
$route : Route
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

getVariant()

Builds a variant of a route based on the given configuration.

protected getVariant(Route $defaultPageRoute, array<string|int, mixed> $configuration) : Route
Parameters
$defaultPageRoute : Route
$configuration : array<string|int, mixed>
Return values
Route

hasControllerActionValues()

Check if action and controller are not empty.

protected hasControllerActionValues(array<string|int, mixed> $target) : bool
Parameters
$target : array<string|int, mixed>
Return values
bool

modifyRoutePath()

Modify the route path to add the variable names with the aspects, e.g.

protected modifyRoutePath(string $routePath) : string
  • /{locale_modifier}/{product_title} -> /products/{product_title}
  • /{!locale_modifier}/{product_title} -> /products/{product_title}
Parameters
$routePath : string
Return values
string

overrideValuesByAspect()

Overrides items having an aspect definition with a given $overrideValue in target $targetValue array.

protected overrideValuesByAspect(Route $route, array<string|int, mixed> $values, string $targetValue) : array<string|int, mixed>
Parameters
$route : Route
$values : array<string|int, mixed>
$targetValue : string
Return values
array<string|int, mixed>

resolveType()

Retrieves type from processed route and modifies remaining query parameters.

protected resolveType(Route $route, array<string|int, mixed> &$remainingQueryParameters) : string
Parameters
$route : Route
$remainingQueryParameters : array<string|int, mixed>

reference to remaining query parameters

Return values
string

verifyRequiredParameters()

Check if controller+action combination matches

protected verifyRequiredParameters(Route $route, array<string|int, mixed> $parameters) : bool
Parameters
$route : Route
$parameters : array<string|int, mixed>
Return values
bool

        
On this page

Search results