You are here

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

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformHandler/EmailWebformHandler.php \Drupal\webform\Plugin\WebformHandler\EmailWebformHandler::create()

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 WebformHandlerBase::create

1 call to EmailWebformHandler::create()
ScheduleEmailWebformHandler::create in modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php
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…
1 method overrides EmailWebformHandler::create()
ScheduleEmailWebformHandler::create in modules/webform_scheduled_email/src/Plugin/WebformHandler/ScheduleEmailWebformHandler.php
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…

File

src/Plugin/WebformHandler/EmailWebformHandler.php, line 129

Class

EmailWebformHandler
Emails a webform submission.

Namespace

Drupal\webform\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->currentUser = $container
    ->get('current_user');
  $instance->moduleHandler = $container
    ->get('module_handler');
  $instance->languageManager = $container
    ->get('language_manager');
  $instance->mailManager = $container
    ->get('plugin.manager.mail');
  $instance->themeManager = $container
    ->get('webform.theme_manager');
  $instance->tokenManager = $container
    ->get('webform.token_manager');
  $instance->elementManager = $container
    ->get('plugin.manager.webform.element');
  return $instance;
}