Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / field_ui / src / Form / EntityFormModeAddForm.php
1 <?php
2
3 namespace Drupal\field_ui\Form;
4
5 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
6
7 /**
8  * Provides the add form for entity display modes.
9  *
10  * @internal
11  */
12 class EntityFormModeAddForm extends EntityDisplayModeAddForm {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function prepareEntity() {
18     $definition = $this->entityManager->getDefinition($this->targetEntityTypeId);
19     if (!$definition->get('field_ui_base_route') || !$definition->hasFormClasses()) {
20       throw new NotFoundHttpException();
21     }
22
23     $this->entity->setTargetType($this->targetEntityTypeId);
24   }
25
26 }