Enhances an entity form route with the appropriate controller.
Expanded class hierarchy of EntityFormEnhancer
class EntityFormEnhancer implements RouteEnhancerInterface {
/**
* Content negotiation library.
*
* @var \Drupal\CoreContentNegotiation
*/
protected $negotiation;
/**
* Constructs a new \Drupal\Core\Entity\Enhancer\EntityFormEnhancer.
*
* @param \Drupal\Core\ContentNegotiation $negotiation
* The content negotiation library.
*/
public function __construct(ContentNegotiation $negotiation) {
$this->negotiation = $negotiation;
}
/**
* {@inheritdoc}
*/
public function enhance(array $defaults, Request $request) {
if (empty($defaults['_controller']) && !empty($defaults['_entity_form']) && $this->negotiation
->getContentType($request) === 'html') {
$defaults['_controller'] = '\\Drupal\\Core\\Entity\\HtmlEntityFormController::content';
}
return $defaults;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityFormEnhancer:: |
protected | property | Content negotiation library. | |
EntityFormEnhancer:: |
public | function |
Update the defaults based on its own data and the request. Overrides RouteEnhancerInterface:: |
|
EntityFormEnhancer:: |
public | function | Constructs a new \Drupal\Core\Entity\Enhancer\EntityFormEnhancer. |