You are here

public function AutosaveEntityFormHandler::__construct in Autosave Form 8

Initializes an instance of the autosave form controller.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: Entity type manager.

\Drupal\Core\Session\AccountInterface $current_user: The current user.

\Drupal\autosave_form\Storage\AutosaveEntityFormStorageInterface $autosave_entity_form_storage: The autosave form storage service.

\Drupal\Component\Datetime\TimeInterface $time: The time service.

\Drupal\Core\Datetime\DateFormatterInterface $date_formatter: The date formatter.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface $key_value_expirable_factory: The key value expirable factory, used to create key value expirable stores for the form cache and form state cache.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler service.

File

src/Form/AutosaveEntityFormHandler.php, line 132

Class

AutosaveEntityFormHandler
Base class for autosave form handlers.

Namespace

Drupal\autosave_form\Form

Code

public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerInterface $entity_type_manager, AccountInterface $current_user, AutosaveEntityFormStorageInterface $autosave_entity_form_storage, TimeInterface $time, DateFormatterInterface $date_formatter, ConfigFactoryInterface $config_factory, KeyValueExpirableFactoryInterface $key_value_expirable_factory, ModuleHandlerInterface $module_handler) {
  $this->entityTypeId = $entity_type
    ->id();
  $this->entityType = $entity_type;
  $this->entityStorage = $entity_type_manager
    ->getStorage($entity_type
    ->id());
  $this->currentUser = $current_user;
  $this->autosaveEntityFormStorage = $autosave_entity_form_storage;
  $this->time = $time;
  $this->dateFormatter = $date_formatter;
  $this->configFactory = $config_factory;
  $this->keyValueExpirableFactory = $key_value_expirable_factory;
  $this->conflictEnabled = $module_handler
    ->moduleExists('conflict');
}