You are here

public static function TestEntityMappingWebformHandler::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 WebformHandlerBase::create

File

tests/modules/webform_test_handler/src/Plugin/WebformHandler/TestEntityMappingWebformHandler.php, line 47

Class

TestEntityMappingWebformHandler
Webform submission entity mapping test handler.

Namespace

Drupal\webform_test_handler\Plugin\WebformHandler

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  $instance = new static($configuration, $plugin_id, $plugin_definition);
  $instance->entityTypeManager = $container
    ->get('entity_type.manager');
  $instance->entityFieldManager = $container
    ->get('entity_field.manager');
  return $instance;
}