You are here

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

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformVariantBase.php \Drupal\webform\Plugin\WebformVariantBase::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 ContainerFactoryPluginInterface::create

1 call to WebformVariantBase::create()
OverrideWebformVariant::create in src/Plugin/WebformVariant/OverrideWebformVariant.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 WebformVariantBase::create()
OverrideWebformVariant::create in src/Plugin/WebformVariant/OverrideWebformVariant.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/WebformVariantBase.php, line 84

Class

WebformVariantBase
Provides a base class for a webform variant.

Namespace

Drupal\webform\Plugin

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  $instance = new static($configuration, $plugin_id, $plugin_definition);
  $instance->configFactory = $container
    ->get('config.factory');
  $instance
    ->setConfiguration($configuration);
  return $instance;
}