function EntityDisplayModeAddForm::prepareEntity

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

Overrides EntityForm::prepareEntity

1 method overrides EntityDisplayModeAddForm::prepareEntity()
EntityFormModeAddForm::prepareEntity in core/modules/field_ui/src/Form/EntityFormModeAddForm.php
Prepares the entity object before the form is built first.

File

core/modules/field_ui/src/Form/EntityDisplayModeAddForm.php, line 40

Class

EntityDisplayModeAddForm
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->hasViewBuilderClass()) {
        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.