You are here

public function EntityDisplayFormBase::getEntityFromRouteMatch in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::getEntityFromRouteMatch()
  2. 9 core/modules/field_ui/src/Form/EntityDisplayFormBase.php \Drupal\field_ui\Form\EntityDisplayFormBase::getEntityFromRouteMatch()

Determines which entity will be used by this form from a RouteMatch object.

Parameters

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

string $entity_type_id: The entity type identifier.

Return value

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

Overrides EntityForm::getEntityFromRouteMatch

File

core/modules/field_ui/src/Form/EntityDisplayFormBase.php, line 89

Class

EntityDisplayFormBase
Base class for EntityDisplay edit forms.

Namespace

Drupal\field_ui\Form

Code

public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id) {
  $route_parameters = $route_match
    ->getParameters()
    ->all();
  return $this
    ->getEntityDisplay($route_parameters['entity_type_id'], $route_parameters['bundle'], $route_parameters[$this->displayContext . '_mode_name']);
}