public function AjaxEnhancer::enhance

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

Parameters

array $defaults the getRouteDefaults array:

Return value

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

Overrides RouteEnhancerInterface::enhance

File

drupal/core/lib/Drupal/Core/Routing/Enhancer/AjaxEnhancer.php, line 39
Contains \Drupal\Core\Routing\Enhancer\AjaxEnhancer.

Class

AjaxEnhancer
Enhances an ajax route with the appropriate controller.

Namespace

Drupal\Core\Routing\Enhancer

Code

public function enhance(array $defaults, Request $request) {
  if (empty($defaults['_content']) && $this->negotiation
    ->getContentType($request) == 'drupal_ajax') {
    $defaults['_content'] = isset($defaults['_controller']) ? $defaults['_controller'] : NULL;
    $defaults['_controller'] = '\\Drupal\\Core\\Controller\\AjaxController::content';
  }
  return $defaults;
}