You are here

public function WebformVariantBase::__construct in Webform 8.5

Constructs a WebformVariantBase object.

IMPORTANT: Webform variants 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.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The configuration factory.

Overrides PluginBase::__construct

See also

\Drupal\webform\Entity\Webform::getVariants

1 call to WebformVariantBase::__construct()
OverrideWebformVariant::__construct in src/Plugin/WebformVariant/OverrideWebformVariant.php
Constructs a OverrideWebformVariant object.
1 method overrides WebformVariantBase::__construct()
OverrideWebformVariant::__construct in src/Plugin/WebformVariant/OverrideWebformVariant.php
Constructs a OverrideWebformVariant object.

File

src/Plugin/WebformVariantBase.php, line 96

Class

WebformVariantBase
Provides a base class for a webform variant.

Namespace

Drupal\webform\Plugin

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this
    ->setConfiguration($configuration);
  $this->configFactory = $config_factory;
}