EntityRouteEnhancer::enhance

public EntityRouteEnhancer::enhance(array $defaults, Request $request)

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/Entity/Enhancer/EntityRouteEnhancer.php, line 18

Class

EntityRouteEnhancer
Enhances an entity form route with the appropriate controller.

Namespace

Drupal\Core\Entity\Enhancer

Code

public function enhance(array $defaults, Request $request) {
  if (empty($defaults['_controller'])) {
    if (!empty($defaults['_entity_form'])) {
      $defaults = $this->enhanceEntityForm($defaults, $request);
    }
    elseif (!empty($defaults['_entity_list'])) {
      $defaults = $this->enhanceEntityList($defaults, $request);
    }
    elseif (!empty($defaults['_entity_view'])) {
      $defaults = $this->enhanceEntityView($defaults, $request);
    }
  }
  return $defaults;
}
doc_Drupal
2016-10-29 09:07:33
Comments
Leave a Comment

Please login to continue.