You are here

public static function AddMailchimpEventWebformHandler::create in Mailchimp 2.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 WebformHandlerBase::create

File

modules/mailchimp_events/src/Plugin/WebformHandler/AddMailchimpEventWebformHandler.php, line 39

Class

AddMailchimpEventWebformHandler
Webform submission Event handler.

Namespace

Drupal\mailchimp_events\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->tokenManager = $container
    ->get('webform.token_manager');
  return $instance;
}