9cecd83625171b5c17eacd24568a31e241732317
[yaffs-website] / 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 class EntityFormModeAddForm extends EntityDisplayModeAddForm {
11
12   /**
13    * {@inheritdoc}
14    */
15   protected function prepareEntity() {
16     $definition = $this->entityManager->getDefinition($this->targetEntityTypeId);
17     if (!$definition->get('field_ui_base_route') || !$definition->hasFormClasses()) {
18       throw new NotFoundHttpException();
19     }
20
21     $this->entity->setTargetType($this->targetEntityTypeId);
22   }
23
24 }