public function RouteEnhancer::enhance in Automatic Entity Label 8
Same name and namespace in other branches
- 8.3 src/Routing/RouteEnhancer.php \Drupal\auto_entitylabel\Routing\RouteEnhancer::enhance()
- 8.2 src/Routing/RouteEnhancer.php \Drupal\auto_entitylabel\Routing\RouteEnhancer::enhance()
File
- src/
Routing/ RouteEnhancer.php, line 38
Class
- RouteEnhancer
- Route Enhancer class.
Namespace
Drupal\auto_entitylabel\RoutingCode
public function enhance(array $defaults, Request $request) {
if (($bundle = $this->entityManager
->getDefinition($defaults['entity_type_id'])
->getBundleEntityType()) && isset($defaults[$bundle])) {
// Auto Entity Label 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;
}