You are here

interface WebformVariantInterface in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformVariantInterface.php \Drupal\webform\Plugin\WebformVariantInterface

Defines the interface for webform variants.

Hierarchy

Expanded class hierarchy of WebformVariantInterface

All classes that implement WebformVariantInterface

See also

\Drupal\webform\Annotation\WebformVariant

\Drupal\webform\Plugin\WebformVariantBase

\Drupal\webform\Plugin\WebformVariantManager

\Drupal\webform\Plugin\WebformVariantManagerInterface

Plugin API

2 files declare their use of WebformVariantInterface
Webform.php in src/Entity/Webform.php
WebformInterface.php in src/WebformInterface.php

File

src/Plugin/WebformVariantInterface.php, line 20

Namespace

Drupal\webform\Plugin
View source
interface WebformVariantInterface extends PluginInspectionInterface, ConfigurableInterface, ContainerFactoryPluginInterface, PluginFormInterface, WebformEntityInjectionInterface, WebformPluginSettingsInterface {

  /**
   * Returns a render array summarizing the configuration of the webform variant.
   *
   * @return array
   *   A render array.
   */
  public function getSummary();

  /**
   * Returns the webform variant label.
   *
   * @return string
   *   The webform variant label.
   */
  public function label();

  /**
   * Returns the webform variant description.
   *
   * @return string
   *   The webform variant description.
   */
  public function description();

  /**
   * Returns the webform variant machine name replacement pattern.
   *
   * @return string|NULL
   *   The webform variant machine name replacement pattern.
   */
  public function getMachineNameReplacePattern();

  /**
   * Returns the webform variant machine name replacement character.
   *
   * @return string|NULL
   *   The webform variant machine name replacement character.
   */
  public function getMachineNameReplace();

  /**
   * Returns the unique ID representing the webform variant.
   *
   * @return string
   *   The webform variant ID.
   */
  public function getVariantId();

  /**
   * Sets the id for this webform variant.
   *
   * @param int $variant_id
   *   The variant_id for this webform variant.
   *
   * @return $this
   */
  public function setVariantId($variant_id);

  /**
   * Returns the element key of the webform variant.
   *
   * @return string
   *   The webform element key.
   */
  public function getElementKey();

  /**
   * Sets the element key of this webform variant.
   *
   * @param int $element_key
   *   The element key for this webform variant.
   *
   * @return $this
   */
  public function setElementKey($element_key);

  /**
   * Returns the label of the webform variant.
   *
   * @return string
   *   The label of the webform variant, or an empty string.
   */
  public function getLabel();

  /**
   * Sets the label for this webform variant.
   *
   * @param string $label
   *   The label for this webform variant.
   *
   * @return $this
   */
  public function setLabel($label);

  /**
   * Returns notes of the webform variant.
   *
   * @return string
   *   Notes for the webform variant, or an empty string.
   */
  public function getNotes();

  /**
   * Set notes for this webform variant.
   *
   * @param string $notes
   *   Notes for this webform variant.
   *
   * @return $this
   */
  public function setNotes($notes);

  /**
   * Returns the weight of the webform variant.
   *
   * @return int|string
   *   Either the integer weight of the webform variant, or an empty string.
   */
  public function getWeight();

  /**
   * Sets the weight for this webform variant.
   *
   * @param int $weight
   *   The weight for this webform variant.
   *
   * @return $this
   */
  public function setWeight($weight);

  /**
   * Returns the status of the webform variant.
   *
   * @return bool
   *   The status of the webform variant.
   */
  public function getStatus();

  /**
   * Sets the status for this webform variant.
   *
   * @param bool $status
   *   The status for this webform variant.
   *
   * @return $this
   */
  public function setStatus($status);

  /**
   * Enables the webform variant.
   *
   * @return $this
   */
  public function enable();

  /**
   * Disables the webform variant.
   *
   * @return $this
   */
  public function disable();

  /**
   * Checks if the variant is excluded via webform.settings.
   *
   * @return bool
   *   TRUE if the variant is excluded.
   */
  public function isExcluded();

  /**
   * Returns the webform variant enabled indicator.
   *
   * @return bool
   *   TRUE if the webform variant is enabled.
   */
  public function isEnabled();

  /**
   * Returns the webform variant disabled indicator.
   *
   * @return bool
   *   TRUE if the webform variant is disabled.
   */
  public function isDisabled();

  /**
   * Determine if this variant is applicable to the webform.
   *
   * @param \Drupal\webform\WebformInterface $webform
   *   A webform.
   *
   * @return bool
   *   TRUE if this variant is applicable to the webform.
   */
  public function isApplicable(WebformInterface $webform);

  /**
   * Get configuration form's off-canvas width.
   *
   * @return string
   *   The off-canvas width.
   *
   * @see WebformDialogHelper::DIALOG_NARROW
   * @see WebformDialogHelper::DIALOG_NORMAL
   * @see WebformDialogHelper::DIALOG_WIDE
   * @see WebformDialogHelper::DIALOG_NONE
   */
  public function getOffCanvasWidth();

  /**
   * Apply variant to the webform.
   *
   * @return bool
   *   TRUE if this variant was applied to the webform.
   */
  public function applyVariant();

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
ContainerFactoryPluginInterface::create public static function Creates an instance of the plugin. 112
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
WebformEntityInjectionInterface::getWebform public function Get the webform that this handler is attached to.
WebformEntityInjectionInterface::getWebformSubmission public function Get the webform submission that this handler is handling.
WebformEntityInjectionInterface::resetEntities public function Reset webform and webform submission entity.
WebformEntityInjectionInterface::setEntities public function Set webform and webform submission entity.
WebformEntityInjectionInterface::setWebform public function Set the webform that this is handler is attached to.
WebformEntityInjectionInterface::setWebformSubmission public function Set the webform submission that this handler is handling.
WebformPluginSettingsInterface::getSetting public function Returns the plugin setting for given key
WebformPluginSettingsInterface::getSettings public function Returns the plugin's settings.
WebformPluginSettingsInterface::setSetting public function Sets a plugin setting for a given key.
WebformPluginSettingsInterface::setSettings public function Update a plugin's settings.
WebformVariantInterface::applyVariant public function Apply variant to the webform. 1
WebformVariantInterface::description public function Returns the webform variant description. 1
WebformVariantInterface::disable public function Disables the webform variant. 1
WebformVariantInterface::enable public function Enables the webform variant. 1
WebformVariantInterface::getElementKey public function Returns the element key of the webform variant. 1
WebformVariantInterface::getLabel public function Returns the label of the webform variant. 1
WebformVariantInterface::getMachineNameReplace public function Returns the webform variant machine name replacement character. 1
WebformVariantInterface::getMachineNameReplacePattern public function Returns the webform variant machine name replacement pattern. 1
WebformVariantInterface::getNotes public function Returns notes of the webform variant. 1
WebformVariantInterface::getOffCanvasWidth public function Get configuration form's off-canvas width. 1
WebformVariantInterface::getStatus public function Returns the status of the webform variant. 1
WebformVariantInterface::getSummary public function Returns a render array summarizing the configuration of the webform variant. 1
WebformVariantInterface::getVariantId public function Returns the unique ID representing the webform variant. 1
WebformVariantInterface::getWeight public function Returns the weight of the webform variant. 1
WebformVariantInterface::isApplicable public function Determine if this variant is applicable to the webform. 1
WebformVariantInterface::isDisabled public function Returns the webform variant disabled indicator. 1
WebformVariantInterface::isEnabled public function Returns the webform variant enabled indicator. 1
WebformVariantInterface::isExcluded public function Checks if the variant is excluded via webform.settings. 1
WebformVariantInterface::label public function Returns the webform variant label. 1
WebformVariantInterface::setElementKey public function Sets the element key of this webform variant. 1
WebformVariantInterface::setLabel public function Sets the label for this webform variant. 1
WebformVariantInterface::setNotes public function Set notes for this webform variant. 1
WebformVariantInterface::setStatus public function Sets the status for this webform variant. 1
WebformVariantInterface::setVariantId public function Sets the id for this webform variant. 1
WebformVariantInterface::setWeight public function Sets the weight for this webform variant. 1