public function EntityFormModeBase::entityEdit in Form mode manager 8
Provides the entity 'edit' form.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.
Return value
array The entity edit Form.
1 method overrides EntityFormModeBase::entityEdit()
- UserFormModeController::entityEdit in src/
Controller/ UserFormModeController.php - Provides the entity 'edit' form.
File
- src/
Controller/ EntityFormModeBase.php, line 231
Class
- EntityFormModeBase
- Controller for entity form mode support.
Namespace
Drupal\form_mode_manager\ControllerCode
public function entityEdit(RouteMatchInterface $route_match) {
/* @var \Drupal\Core\Entity\EntityInterface $entity */
$entity = $this
->getEntityFromRouteMatch($route_match);
$form_mode_id = $this->formModeManager
->getFormModeMachineName($route_match
->getRouteObject()
->getOption('parameters')['form_mode']['id']);
$operation = empty($form_mode_id) ? 'default' : 'edit_' . $form_mode_id;
if ($entity instanceof EntityInterface) {
return $this
->getForm($entity, $operation);
}
}