You are here

class WebformVariant in Webform 8.5

Same name in this branch
  1. 8.5 src/Annotation/WebformVariant.php \Drupal\webform\Annotation\WebformVariant
  2. 8.5 src/Element/WebformVariant.php \Drupal\webform\Element\WebformVariant
  3. 8.5 src/Plugin/WebformElement/WebformVariant.php \Drupal\webform\Plugin\WebformElement\WebformVariant
Same name and namespace in other branches
  1. 6.x src/Annotation/WebformVariant.php \Drupal\webform\Annotation\WebformVariant

Defines a webform variant annotation object.

Plugin Namespace: Plugin\WebformVariant.

For a working example, see \Drupal\webform\Plugin\WebformVariant\OverrideWebformVariant

Hierarchy

Expanded class hierarchy of WebformVariant

See also

hook_webform_variant_info_alter()

\Drupal\webform\Plugin\WebformVariantInterface

\Drupal\webform\Plugin\WebformVariantBase

\Drupal\webform\Plugin\WebformVariantManager

Plugin API

5 classes are annotated with WebformVariant
BrokenWebformVariant in src/Plugin/WebformVariant/BrokenWebformVariant.php
Defines a fallback plugin for missing webform variant plugins.
ExampleWebformVariant in modules/webform_example_variant/src/Plugin/WebformVariant/ExampleWebformVariant.php
Webform example variant.
OverrideWebformVariant in src/Plugin/WebformVariant/OverrideWebformVariant.php
Webform override variant.
TestWebformOffCanvasWidthVariant in tests/modules/webform_test_variant/src/Plugin/WebformVariant/TestWebformOffCanvasWidthVariant.php
Webform variant off-canvas width.
TestWebformVariant in tests/modules/webform_test_variant/src/Plugin/WebformVariant/TestWebformVariant.php
Webform example variant.

File

src/Annotation/WebformVariant.php, line 23

Namespace

Drupal\webform\Annotation
View source
class WebformVariant extends Plugin {

  /**
   * The plugin ID.
   *
   * @var string
   */
  public $id;

  /**
   * The human-readable name of the webform variant.
   *
   * @var \Drupal\Core\Annotation\Translation
   *
   * @ingroup plugin_translatable
   */
  public $label;

  /**
   * The category in the admin UI where the block will be listed.
   *
   * @var \Drupal\Core\Annotation\Translation
   *
   * @ingroup plugin_translatable
   */
  public $category = '';

  /**
   * A brief description of the webform variant.
   *
   * This will be shown when adding or configuring this webform variant.
   *
   * @var \Drupal\Core\Annotation\Translation
   *
   * @ingroup plugin_translatable
   */
  public $description = '';

  /**
   * The machine name replacement pattern.
   *
   * @var string
   */
  public $machine_name_replace_pattern = '[^a-z0-9_]+';

  /**
   * The machine name replacement character.
   *
   * @var string
   */
  public $machine_name_replace = '_';

}

Members

Namesort descending Modifiers Type Description Overrides
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::get public function Gets the value of an annotation. Overrides AnnotationInterface::get 5
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider
Plugin::__construct public function Constructs a Plugin object. 2
WebformVariant::$category public property The category in the admin UI where the block will be listed.
WebformVariant::$description public property A brief description of the webform variant.
WebformVariant::$id public property The plugin ID.
WebformVariant::$label public property The human-readable name of the webform variant.
WebformVariant::$machine_name_replace public property The machine name replacement character.
WebformVariant::$machine_name_replace_pattern public property The machine name replacement pattern.