function EntityFormModeAddForm::prepareEntity

Same name in other branches
  1. 9 core/modules/field_ui/src/Form/EntityFormModeAddForm.php \Drupal\field_ui\Form\EntityFormModeAddForm::prepareEntity()
  2. 10 core/modules/field_ui/src/Form/EntityFormModeAddForm.php \Drupal\field_ui\Form\EntityFormModeAddForm::prepareEntity()
  3. 11.x core/modules/field_ui/src/Form/EntityFormModeAddForm.php \Drupal\field_ui\Form\EntityFormModeAddForm::prepareEntity()

Overrides EntityDisplayModeAddForm::prepareEntity

File

core/modules/field_ui/src/Form/EntityFormModeAddForm.php, line 17

Class

EntityFormModeAddForm
Provides the add form for entity display modes.

Namespace

Drupal\field_ui\Form

Code

protected function prepareEntity() {
    $definition = $this->entityTypeManager
        ->getDefinition($this->targetEntityTypeId);
    if (!$definition->get('field_ui_base_route') || !$definition->hasFormClasses()) {
        throw new NotFoundHttpException();
    }
    $this->entity
        ->setTargetType($this->targetEntityTypeId);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.