You are here

public function ParamConversionEnhancer::enhance in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php \Drupal\Core\Routing\Enhancer\ParamConversionEnhancer::enhance()

Update the defaults based on its own data and the request.

Parameters

array $defaults the getRouteDefaults array.:

Request $request the Request instance.:

Return value

array the modified defaults. Each enhancer MUST return the $defaults but may add or remove values.

Overrides RouteEnhancerInterface::enhance

File

core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php, line 46
Contains \Drupal\Core\Routing\Enhancer\ParamConversionEnhancer.

Class

ParamConversionEnhancer
Provides a route enhancer that handles parameter conversion.

Namespace

Drupal\Core\Routing\Enhancer

Code

public function enhance(array $defaults, Request $request) {

  // Just run the parameter conversion once per request.
  if (!isset($defaults['_raw_variables'])) {
    $defaults['_raw_variables'] = $this
      ->copyRawVariables($defaults);
    $defaults = $this->paramConverterManager
      ->convert($defaults);
  }
  return $defaults;
}