You are here

public function FieldStorageConfigEditForm::getEntityFromRouteMatch in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php \Drupal\field_ui\Form\FieldStorageConfigEditForm::getEntityFromRouteMatch()
  2. 9 core/modules/field_ui/src/Form/FieldStorageConfigEditForm.php \Drupal\field_ui\Form\FieldStorageConfigEditForm::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/FieldStorageConfigEditForm.php, line 30

Class

FieldStorageConfigEditForm
Provides a form for the "field storage" edit page.

Namespace

Drupal\field_ui\Form

Code

public function getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id) {

  // The URL of this entity form contains only the ID of the field_config
  // but we are actually editing a field_storage_config entity.
  $field_config = FieldConfig::load($route_match
    ->getRawParameter('field_config'));
  if (!$field_config) {
    throw new NotFoundHttpException();
  }
  return $field_config
    ->getFieldStorageDefinition();
}