You are here

public function WebformHandlerBase::__construct in Webform 8.5

Constructs a WebformHandlerBase object.

IMPORTANT: Webform handlers are initialized and serialized when they are attached to a webform. Make sure not include any services as a dependency injection that directly connect to the database. This will prevent "LogicException: The database connection is not serializable." exceptions from being thrown when a form is serialized via an Ajax callback and/or form build.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory: The logger factory.

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

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

\Drupal\webform\WebformSubmissionConditionsValidatorInterface $conditions_validator: The webform submission conditions (#states) validator.

Overrides PluginBase::__construct

See also

\Drupal\webform\Entity\Webform::getHandlers

7 calls to WebformHandlerBase::__construct()
ActionWebformHandler::__construct in src/Plugin/WebformHandler/ActionWebformHandler.php
Constructs a WebformHandlerBase object.
DebugWebformHandler::__construct in src/Plugin/WebformHandler/DebugWebformHandler.php
Constructs a WebformHandlerBase object.
EmailWebformHandler::__construct in src/Plugin/WebformHandler/EmailWebformHandler.php
Constructs a WebformHandlerBase object.
ExampleWebformHandler::__construct in modules/webform_example_handler/src/Plugin/WebformHandler/ExampleWebformHandler.php
Constructs a WebformHandlerBase object.
OptionsLimitWebformHandler::__construct in modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php
Constructs a WebformHandlerBase object.

... See full list

7 methods override WebformHandlerBase::__construct()
ActionWebformHandler::__construct in src/Plugin/WebformHandler/ActionWebformHandler.php
Constructs a WebformHandlerBase object.
DebugWebformHandler::__construct in src/Plugin/WebformHandler/DebugWebformHandler.php
Constructs a WebformHandlerBase object.
EmailWebformHandler::__construct in src/Plugin/WebformHandler/EmailWebformHandler.php
Constructs a WebformHandlerBase object.
ExampleWebformHandler::__construct in modules/webform_example_handler/src/Plugin/WebformHandler/ExampleWebformHandler.php
Constructs a WebformHandlerBase object.
OptionsLimitWebformHandler::__construct in modules/webform_options_limit/src/Plugin/WebformHandler/OptionsLimitWebformHandler.php
Constructs a WebformHandlerBase object.

... See full list

File

src/Plugin/WebformHandlerBase.php, line 158

Class

WebformHandlerBase
Provides a base class for a webform handler.

Namespace

Drupal\webform\Plugin

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, LoggerChannelFactoryInterface $logger_factory, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, WebformSubmissionConditionsValidatorInterface $conditions_validator) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->loggerFactory = $logger_factory;
  $this->configFactory = $config_factory;
  $this->submissionStorage = $entity_type_manager
    ->getStorage('webform_submission');
  $this->conditionsValidator = $conditions_validator;

  // @todo Webform 8.x-6.x: Properly inject the token manager.
  // @todo Webform 8.x-6.x: Update handlers that injects the token manager.
  $this->tokenManager = \Drupal::service('webform.token_manager');
  $this
    ->setConfiguration($configuration);
}