EntityFormModeAddForm.php

Same filename in other branches
  1. 8.9.x core/modules/field_ui/src/Form/EntityFormModeAddForm.php
  2. 10 core/modules/field_ui/src/Form/EntityFormModeAddForm.php
  3. 11.x core/modules/field_ui/src/Form/EntityFormModeAddForm.php

Namespace

Drupal\field_ui\Form

File

core/modules/field_ui/src/Form/EntityFormModeAddForm.php

View source
<?php

namespace Drupal\field_ui\Form;

use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

/**
 * Provides the add form for entity display modes.
 *
 * @internal
 */
class EntityFormModeAddForm extends EntityDisplayModeAddForm {
    
    /**
     * {@inheritdoc}
     */
    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);
    }

}

Classes

Title Deprecated Summary
EntityFormModeAddForm Provides the add form for entity display modes.

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