If the route has a non-null content and if that content class is in the injected map, returns that controller.
Overrides RouteEnhancerInterface::enhance
public function enhance(array $defaults, Request $request) {
if (isset($defaults[$this->target])) {
// no need to do anything
return $defaults;
}
if (!isset($defaults[$this->routefield]) || !$defaults[$this->routefield] instanceof RouteObjectInterface) {
// we can't determine the content
return $defaults;
}
$route = $defaults[$this->routefield];
$content = $route
->getRouteContent();
if (!$content) {
// we have no content
return $defaults;
}
$defaults[$this->target] = $content;
return $defaults;
}