You are here

protected function EntityFormModeBase::getEntityFromRouteMatch in Form mode manager 8

Retrieves entity from route match.

Parameters

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

Return value

\Drupal\Core\Entity\EntityInterface|null The entity object as determined from the passed-in route match.

6 calls to EntityFormModeBase::getEntityFromRouteMatch()
EntityFormModeBase::checkAccess in src/Controller/EntityFormModeBase.php
Checks access for the Form Mode Manager routes.
EntityFormModeBase::entityAdd in src/Controller/EntityFormModeBase.php
Provides the entity add submission form.
EntityFormModeBase::entityEdit in src/Controller/EntityFormModeBase.php
Provides the entity 'edit' form.
EntityFormModeBase::getEntityBundle in src/Controller/EntityFormModeBase.php
Get EntityStorage of entity.
UserFormModeController::entityAdd in src/Controller/UserFormModeController.php
Provides the entity submission form.

... See full list

File

src/Controller/EntityFormModeBase.php, line 427

Class

EntityFormModeBase
Controller for entity form mode support.

Namespace

Drupal\form_mode_manager\Controller

Code

protected function getEntityFromRouteMatch(RouteMatchInterface $route_match) {
  $parameter_name = $route_match
    ->getRouteObject()
    ->getOption('_form_mode_manager_entity_type_id');
  $entity = $route_match
    ->getParameter($parameter_name);
  return $entity;
}