You are here

public function AbstractEntityFormModesFactory::entityEdit in Form mode manager 8.2

Provides the entity 'edit' form.

Parameters

\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.

Overrides EntityFormModeManagerInterface::entityEdit

File

src/AbstractEntityFormModesFactory.php, line 211

Class

AbstractEntityFormModesFactory
Abstract Factory to generate object used by routing of Form Mode Manager.

Namespace

Drupal\form_mode_manager

Code

public function entityEdit(RouteMatchInterface $route_match) {
  $entity = $this
    ->getEntity($route_match);
  $operation = $this
    ->getOperation($route_match, $entity
    ->getEntityTypeId(), 'edit');
  if ($entity instanceof EntityInterface) {
    return $this
      ->getForm($entity, $operation);
  }
  throw new \Exception("Entity retrieve from route isn't an instance of EntityInterface.");
}