You are here

public function AbstractEntityFormModesFactory::entityAdd in Form mode manager 8.2

Provides the entity add submission form.

Parameters

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

Overrides EntityFormModeManagerInterface::entityAdd

File

src/AbstractEntityFormModesFactory.php, line 197

Class

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

Namespace

Drupal\form_mode_manager

Code

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