You are here

public function RobotFormBase::__construct in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/config_entity_example/src/Form/RobotFormBase.php \Drupal\config_entity_example\Form\RobotFormBase::__construct()

Construct the RobotFormBase.

For simple entity forms, there's no need for a constructor. Our robot form base, however, requires an entity query factory to be injected into it from the container. We later use this query factory to build an entity query for the exists() method.

Parameters

\Drupal\Core\Entity\EntityStorageInterface $entity_storage: An entity query factory for the robot entity type.

File

config_entity_example/src/Form/RobotFormBase.php, line 41

Class

RobotFormBase
Class RobotFormBase.

Namespace

Drupal\config_entity_example\Form

Code

public function __construct(EntityStorageInterface $entity_storage) {
  $this->entityStorage = $entity_storage;
}