You are here

public static function HubspotWebformHandler::create in HubSpot 3.x

Same name and namespace in other branches
  1. 8 src/Plugin/WebformHandler/HubspotWebformHandler.php \Drupal\hubspot\Plugin\WebformHandler\HubspotWebformHandler::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

File

src/Plugin/WebformHandler/HubspotWebformHandler.php, line 56

Class

HubspotWebformHandler
Webform submission remote post handler.

Namespace

Drupal\hubspot\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->entityTypeManager = $container
    ->get('entity_type.manager');
  $instance->mailManager = $container
    ->get('plugin.manager.mail');
  $instance->hubspot = $container
    ->get('hubspot.hubspot');
  return $instance;
}