FieldStorageConfigEditForm::getEntityFromRouteMatch

public FieldStorageConfigEditForm::getEntityFromRouteMatch(RouteMatchInterface $route_match, $entity_type_id)

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 28

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();
}
doc_Drupal
2016-10-29 09:12:28
Comments
Leave a Comment

Please login to continue.