You are here

public static function ScheduleEmailWebformHandler::create in Webform 6.x

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.

Overrides EmailWebformHandler::create

File

modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php, line 48

Class

ScheduleEmailWebformHandler
Schedules a webform submission's email.

Namespace

Drupal\webform_scheduled_email\Plugin\WebformHandler

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  $instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);
  $instance->request = $container
    ->get('request_stack')
    ->getCurrentRequest();
  $instance->scheduledEmailManager = $container
    ->get('webform_scheduled_email.manager');
  return $instance;
}