FieldUiRouteEnhancer::enhance

public FieldUiRouteEnhancer::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/modules/field_ui/src/Routing/FieldUiRouteEnhancer.php, line 35

Class

FieldUiRouteEnhancer
Enhances Field UI routes by adding proper information about the bundle name.

Namespace

Drupal\field_ui\Routing

Code

public function enhance(array $defaults, Request $request) {
  if (($bundle = $this->entityManager->getDefinition($defaults['entity_type_id'])->getBundleEntityType()) && isset($defaults[$bundle])) {
    // Field UI forms only need the actual name of the bundle they're dealing
    // with, not an upcasted entity object, so provide a simple way for them
    // to get it.
    $defaults['bundle'] = $defaults['_raw_variables']->get($bundle);
  }

  return $defaults;
}
doc_Drupal
2016-10-29 09:12:54
Comments
Leave a Comment

Please login to continue.