public function DefaultsEntityForm::getEntityFromRouteMatch in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/src/Form/DefaultsEntityForm.php \Drupal\layout_builder\Form\DefaultsEntityForm::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/ layout_builder/ src/ Form/ DefaultsEntityForm.php, line 167
Class
- DefaultsEntityForm
- Provides a form containing the Layout Builder UI for defaults.
Namespace
Drupal\layout_builder\FormCode
public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id) {
$route_parameters = $route_match
->getParameters()
->all();
return $this->entityTypeManager
->getStorage('entity_view_display')
->load($route_parameters['entity_type_id'] . '.' . $route_parameters['bundle'] . '.' . $route_parameters['view_mode_name']);
}