You are here

interface WebformInterface in Webform 8.5

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

Provides an interface defining a webform entity.

Hierarchy

Expanded class hierarchy of WebformInterface

All classes that implement WebformInterface

168 files declare their use of WebformInterface
Address.php in src/Plugin/WebformElement/Address.php
BooleanBase.php in src/Plugin/WebformElement/BooleanBase.php
ContainerBase.php in src/Plugin/WebformElement/ContainerBase.php
DateBase.php in src/Plugin/WebformElement/DateBase.php
ExampleWebformHandler.php in modules/webform_example_handler/src/Plugin/WebformHandler/ExampleWebformHandler.php

... See full list

File

src/WebformInterface.php, line 14

Namespace

Drupal\webform
View source
interface WebformInterface extends ConfigEntityInterface, EntityWithPluginCollectionInterface, EntityOwnerInterface {

  /**
   * Webform title.
   */
  const TITLE_WEBFORM = 'webform';

  /**
   * Source entity title.
   */
  const TITLE_SOURCE_ENTITY = 'source_entity';

  /**
   * Both source entity and webform title.
   */
  const TITLE_SOURCE_ENTITY_WEBFORM = 'source_entity_webform';

  /**
   * Both webform and source entity title.
   */
  const TITLE_WEBFORM_SOURCE_ENTITY = 'webform_source_entity';

  /**
   * Denote drafts are not allowed.
   *
   * @var string
   */
  const DRAFT_NONE = 'none';

  /**
   * Denote drafts are allowed for authenticated users only.
   *
   * @var string
   */
  const DRAFT_AUTHENTICATED = 'authenticated';

  /**
   * Denote drafts are allowed for authenticated and anonymous users.
   *
   * @var string
   */
  const DRAFT_ALL = 'all';

  /**
   * Webform status open.
   */
  const STATUS_OPEN = 'open';

  /**
   * Webform status closed.
   */
  const STATUS_CLOSED = 'closed';

  /**
   * Webform status scheduled.
   */
  const STATUS_SCHEDULED = 'scheduled';

  /**
   * Webform status archived.
   */
  const STATUS_ARCHIVED = 'archived';

  /**
   * Webform confirmation page.
   */
  const CONFIRMATION_PAGE = 'page';

  /**
   * Webform confirmation URL.
   */
  const CONFIRMATION_URL = 'url';

  /**
   * Webform confirmation URL with message.
   */
  const CONFIRMATION_URL_MESSAGE = 'url_message';

  /**
   * Webform confirmation inline.
   */
  const CONFIRMATION_INLINE = 'inline';

  /**
   * Webform confirmation message.
   */
  const CONFIRMATION_MESSAGE = 'message';

  /**
   * Webform confirmation modal.
   */
  const CONFIRMATION_MODAL = 'modal';

  /**
   * Webform confirmation default.
   */
  const CONFIRMATION_DEFAULT = 'default';

  /**
   * Webform confirmation none.
   */
  const CONFIRMATION_NONE = 'none';

  /**
   * Display standard 403 access denied page.
   */
  const ACCESS_DENIED_DEFAULT = 'default';

  /**
   * Display customized access denied message.
   */
  const ACCESS_DENIED_MESSAGE = 'message';

  /**
   * Display customized 403 access denied page.
   */
  const ACCESS_DENIED_PAGE = 'page';

  /**
   * Redirect to user login with custom message.
   */
  const ACCESS_DENIED_LOGIN = 'login';

  /**
   * Wizard start page.
   */
  const PAGE_START = 'webform_start';

  /**
   * Wizard preview page.
   */
  const PAGE_PREVIEW = 'webform_preview';

  /**
   * Wizard confirmation page.
   */
  const PAGE_CONFIRMATION = 'webform_confirmation';

  /**
   * Returns the webform's (original) langcode.
   *
   * @return string
   *   The webform's (original) langcode.
   */
  public function getLangcode();

  /**
   * Returns the webform's weight.
   *
   * Only applies to when multiple webforms are attached to a single node.
   *
   * @return int
   *   The webform's weight.
   */
  public function getWeight();

  /**
   * Determine if the webform has page or is attached to other entities.
   *
   * @return bool
   *   TRUE if the webform is a page with dedicated path.
   */
  public function hasPage();

  /**
   * Determine if the webform's elements include a managed_file upload element.
   *
   * @return bool
   *   TRUE if the webform's elements include a managed_file upload element.
   */
  public function hasManagedFile();

  /**
   * Determine if the webform's elements include attachments.
   *
   * @return bool
   *   TRUE if the webform's elements include attachments.
   */
  public function hasAttachments();

  /**
   * Determine if the webform's elements include computed values.
   *
   * @return bool
   *   TRUE if the webform's elements include computed values.
   */
  public function hasComputed();

  /**
   * Determine if the webform's elements include variants.
   *
   * @return bool
   *   TRUE if the webform's elements include variants.
   */
  public function hasVariants();

  /**
   * Determine if the webform is using a Flexbox layout.
   *
   * @return bool
   *   TRUE if the webform is using a Flexbox layout.
   */
  public function hasFlexboxLayout();

  /**
   * Determine if the webform has any containers.
   *
   * @return bool
   *   TRUE if the webform has any containers.
   */
  public function hasContainer();

  /**
   * Determine if the webform has conditional logic (i.e. #states).
   *
   * @return bool
   *   TRUE if the webform has conditional logic.
   */
  public function hasConditions();

  /**
   * Determine if the webform has required elements.
   *
   * @return bool
   *   TRUE if the webform has required elements.
   */
  public function hasRequired();

  /**
   * Determine if the webform has any custom actions (aka submit buttons).
   *
   * @return bool
   *   TRUE if the webform has any custom actions (aka submit buttons).
   */
  public function hasActions();

  /**
   * Get the number of actions (aka submit buttons).
   *
   * @return int
   *   The number of actions (aka submit buttons).
   */
  public function getNumberOfActions();

  /**
   * Determine if the webform has preview page.
   *
   * @return bool
   *   TRUE if the webform has preview page.
   */
  public function hasPreview();

  /**
   * Determine if the webform has multi-step form wizard pages.
   *
   * @return bool
   *   TRUE if the webform has multi-step form wizard pages.
   */
  public function hasWizardPages();

  /**
   * Get the number of wizard pages.
   *
   * @return int
   *   The number of wizard pages.
   */
  public function getNumberOfWizardPages();

  /**
   * Returns the webform's current operation.
   *
   * @return string
   *   The webform's operation.
   */
  public function getOperation();

  /**
   * Sets the webform's current operation .
   *
   * @param string $operation
   *   The webform's operation.
   *
   * @return $this
   *
   * @see \Drupal\webform\WebformSubmissionForm
   */
  public function setOperation($operation);

  /**
   * Determine if the webform is being tested.
   *
   * @return bool
   *   TRUE if the webform is being tested.
   */
  public function isTest();

  /**
   * Sets the webform settings and properties override state.
   *
   * Setting the override state to TRUE allows modules to alter a webform's
   * settings and properties while blocking a webform from being saved with
   * the overridden settings.
   *
   * @param bool $override
   *   The override state of the Webform.
   *
   * @return $this
   *
   * @see \Drupal\webform\WebformInterface::setSettingsOverride
   * @see \Drupal\webform\Entity\Webform::preSave
   */
  public function setOverride($override = TRUE);

  /**
   * Returns the webform override status.
   *
   * @return bool
   *   TRUE if the webform has any overridden settings or properties.
   */
  public function isOverridden();

  /**
   * Sets the webform updating state.
   *
   * Setting the updating state to TRUE ensure that translated elements are
   * not overridden
   *
   * @param bool $override
   *   The updating state of the Webform.
   *
   * @return $this
   *
   * @see \Drupal\webform_ui\WebformUiEntityElementsForm::validateForm
   */
  public function setUpdating($updating = TRUE);

  /**
   * Returns the webform updating status.
   *
   * @return bool
   *   TRUE if the webform is updating.
   */
  public function isUpdating();

  /**
   * Sets the status of the configuration entity.
   *
   * @param string|bool|null $status
   *   The status of the configuration entity.
   *   - TRUE => WebformInterface::STATUS_OPEN.
   *   - FALSE => WebformInterface::STATUS_CLOSED.
   *   - NULL => WebformInterface::STATUS_SCHEDULED.
   *
   * @return $this
   */
  public function setStatus($status);

  /**
   * Returns the webform opened status indicator.
   *
   * @return bool
   *   TRUE if the webform is open to new submissions.
   */
  public function isOpen();

  /**
   * Returns the webform closed status indicator.
   *
   * @return bool
   *   TRUE if the webform is closed to new submissions.
   */
  public function isClosed();

  /**
   * Returns the webform scheduled status indicator.
   *
   * @return bool
   *   TRUE if the webform is scheduled to open/close to new submissions.
   */
  public function isScheduled();

  /**
   * Determines if the webform is currently closed but scheduled to open.
   *
   * @return bool
   *   TRUE if the webform is currently closed but scheduled to open.
   */
  public function isOpening();

  /**
   * Returns the webform template indicator.
   *
   * @return bool
   *   TRUE if the webform is a template and available for duplication.
   */
  public function isTemplate();

  /**
   * Returns the webform archive indicator.
   *
   * @return bool
   *   TRUE if the webform is archived.
   */
  public function isArchived();

  /**
   * Returns the webform confidential indicator.
   *
   * @return bool
   *   TRUE if the webform is confidential.
   */
  public function isConfidential();

  /**
   * Determine if remote IP address is being stored.
   *
   * @return bool
   *   TRUE if remote IP address is being stored.
   */
  public function hasRemoteAddr();

  /**
   * Determine if the saving of submissions is disabled.
   *
   * @return bool
   *   TRUE if the saving of submissions is disabled.
   */
  public function isResultsDisabled();

  /**
   * Checks if a webform has submissions.
   *
   * @return bool
   *   TRUE if the webform has submissions.
   */
  public function hasSubmissions();

  /**
   * Determine if submissions are being logged.
   *
   * @return bool
   *   TRUE if submissions are being logged.
   */
  public function hasSubmissionLog();

  /**
   * Determine if the current webform is translated.
   *
   * @return bool
   *   TRUE if the current webform is translated.
   */
  public function hasTranslations();

  /**
   * Returns the webform's description.
   *
   * @return string
   *   A webform's description.
   */
  public function getDescription();

  /**
   * Sets a webform's description.
   *
   * @param string $description
   *   A description.
   *
   * @return $this
   */
  public function setDescription($description);

  /**
   * Returns the webform's global and custom CSS and JavaScript assets.
   *
   * @return array
   *   An associative array container the webform's CSS and JavaScript.
   */
  public function getAssets();

  /**
   * Returns the webform's CSS.
   *
   * @return string
   *   The webform's CSS.
   */
  public function getCss();

  /**
   * Sets the webform's CSS.
   *
   * @param string $css
   *   The webform's CSS.
   *
   * @return $this
   */
  public function setCss($css);

  /**
   * Returns the webform's JavaScript.
   *
   * @return string
   *   The webform's CSS.
   */
  public function getJavaScript();

  /**
   * Sets the webform's JavaScript.
   *
   * @param string $javascript
   *   The webform's JavaScript.
   *
   * @return $this
   */
  public function setJavaScript($javascript);

  /**
   * Returns the webform settings.
   *
   * @return array
   *   A structured array containing all the webform settings.
   */
  public function getSettings();

  /**
   * Sets the webform settings.
   *
   * @param array $settings
   *   The structured array containing all the webform setting.
   *
   * @return $this
   */
  public function setSettings(array $settings);

  /**
   * Returns the webform settings for a given key.
   *
   * @param string $key
   *   The key of the setting to retrieve.
   * @param bool $default
   *   Flag to lookup the default settings from 'webform.settings' config.
   *   Only used when rendering webform.
   *
   * @return mixed
   *   The settings value, or NULL if no settings exists.
   */
  public function getSetting($key, $default = FALSE);

  /**
   * Sets a webform setting for a given key.
   *
   * @param string $key
   *   The key of the setting to store.
   * @param mixed $value
   *   The data to store.
   *
   * @return $this
   */
  public function setSetting($key, $value);

  /**
   * Reset overridden settings to original settings.
   */
  public function resetSettings();

  /**
   * Sets the webform settings override.
   *
   * Using this methods stops a webform from being saved with the overridden
   * settings.
   *
   * @param array $settings
   *   The structured array containing the webform setting override.
   *
   * @return $this
   */
  public function setSettingsOverride(array $settings);

  /**
   * Sets a webform setting override for a given key.
   *
   * Using this methods stops a webform from being saved with the overridden
   * setting.
   *
   * @param string $key
   *   The key of the setting override to store.
   * @param mixed $value
   *   The data to store.
   *
   * @return $this
   */
  public function setSettingOverride($key, $value);

  /**
   * Sets the value of an overridden property.
   *
   * Using this methods stops a webform from being saved with the overridden
   * property.
   *
   * @param string $property_name
   *   The name of the property that should be set.
   * @param mixed $value
   *   The value the property should be set to.
   *
   * @return $this
   */
  public function setPropertyOverride($property_name, $value);

  /**
   * Returns the webform access rules.
   *
   * @return array
   *   A structured array containing all the webform access rules.
   */
  public function getAccessRules();

  /**
   * Sets the webform access rules.
   *
   * @param array $access
   *   The structured array containing all the webform access rules.
   *
   * @return $this
   */
  public function setAccessRules(array $access);

  /**
   * Returns the webform default settings.
   *
   * @return array
   *   A structured array containing all the webform default settings.
   */
  public static function getDefaultSettings();

  /**
   * Get webform submission webform.
   *
   * @param array $values
   *   (optional) An array of values to set, keyed by property name.
   * @param string $operation
   *   (optional) The operation identifying the webform submission form
   *   variation to be returned.
   *   Defaults to 'add'. This is typically used in routing.
   *
   * @return array
   *   A render array representing a webform submission webform.
   */
  public function getSubmissionForm(array $values = [], $operation = 'add');

  /**
   * Get original elements (YAML) value.
   *
   * @return string|null
   *   The original elements' raw value. Original elements is NULL for new YAML
   *   webforms.
   */
  public function getElementsOriginalRaw();

  /**
   * Get original elements decoded as an associative array.
   *
   * @return array|bool
   *   Elements as an associative array. Returns FALSE if elements YAML is invalid.
   */
  public function getElementsOriginalDecoded();

  /**
   * Get elements (YAML) value.
   *
   * @return string
   *   The elements raw value.
   */
  public function getElementsRaw();

  /**
   * Get webform elements decoded as an associative array.
   *
   * @return array|bool
   *   Elements as an associative array. Returns FALSE if elements YAML is invalid.
   */
  public function getElementsDecoded();

  /**
   * Set element properties.
   *
   * @param string $key
   *   The element's key.
   * @param array $properties
   *   An associative array of properties.
   * @param string $parent_key
   *   (optional) The element's parent key. Only used for new elements.
   *
   * @return $this
   */
  public function setElementProperties($key, array $properties, $parent_key = '');

  /**
   * Remove an element.
   *
   * @param string $key
   *   The element's key.
   */
  public function deleteElement($key);

  /**
   * Get webform elements initialized as an associative array.
   *
   * @return array|bool
   *   Elements as an associative array. Returns FALSE if elements YAML is invalid.
   */
  public function getElementsInitialized();

  /**
   * Get webform raw elements decoded and flattened into an associative array.
   *
   * @param string $operation
   *   (optional) The operation that is to be performed on the element.
   *
   * @return array
   *   Webform raw elements decoded and flattened into an associative array
   *   keyed by element key. Returns FALSE if elements YAML is invalid.
   */
  public function getElementsDecodedAndFlattened($operation = NULL);

  /**
   * Get webform elements initialized and flattened into an associative array.
   *
   * @param string $operation
   *   (optional) The operation that is to be performed on the element.
   *
   * @return array
   *   Webform elements flattened into an associative array keyed by element key.
   *   Returns FALSE if elements YAML is invalid.
   */
  public function getElementsInitializedAndFlattened($operation = NULL);

  /**
   * Get webform flattened list of elements.
   *
   * @param string $operation
   *   (optional) The operation that is to be performed on the element.
   *
   * @return array
   *   Webform elements flattened into an associative array keyed by element key.
   */
  public function getElementsInitializedFlattenedAndHasValue($operation = NULL);

  /**
   * Get webform managed file elements.
   *
   * @return array
   *   Webform managed file elements.
   */
  public function getElementsManagedFiles();

  /**
   * Get webform attachment elements.
   *
   * @return array
   *   Webform attachment elements.
   */
  public function getElementsAttachments();

  /**
   * Get webform computed elements.
   *
   * @return array
   *   Webform computed elements.
   */
  public function getElementsComputed();

  /**
   * Get webform variant elements.
   *
   * @return array
   *   Webform variant elements.
   */
  public function getElementsVariant();

  /**
   * Get webform element's selectors as options.
   *
   * @param array $options
   *   (Optional) Options to be appled to element selectors.
   *
   * @return array
   *   Webform elements selectors as options.
   */
  public function getElementsSelectorOptions(array $options = []);

  /**
   * Get webform element options as autocomplete source values.
   *
   * @return array
   *   Webform element options as autocomplete source values.
   */
  public function getElementsSelectorSourceValues();

  /**
   * Get webform elements that can be prepopulated.
   *
   * @return array
   *   Webform elements that can be prepopulated.
   */
  public function getElementsPrepopulate();

  /**
   * Get webform elements default data.
   *
   * @return array
   *   Webform elements default data.
   */
  public function getElementsDefaultData();

  /**
   * Sets elements (YAML) value.
   *
   * @param array $elements
   *   An renderable array of elements.
   *
   * @return $this
   */
  public function setElements(array $elements);

  /**
   * Get a webform's initialized element.
   *
   * @param string $key
   *   The element's key.
   * @param bool $include_children
   *   Include initialized children.
   *
   * @return array|null
   *   An associative array containing an initialized element.
   */
  public function getElement($key, $include_children = FALSE);

  /**
   * Get a webform's raw (uninitialized) element.
   *
   * @param string $key
   *   The element's key.
   *
   * @return array|null
   *   An associative array containing an raw (uninitialized) element.
   */
  public function getElementDecoded($key);

  /**
   * Get webform wizard pages.
   *
   * @param string $operation
   *   The webform submission operation.
   *   Usually 'default', 'add', 'edit', 'edit_all', 'api', or 'test'.
   * @param \Drupal\webform\WebformSubmissionInterface|null $webform_submission
   *   (Optional) A webform submission. If a webform submission is defined and
   *   the 'wizard_progress_states' is TRUE, wizard page conditional logic
   *   will be evaluated.
   *
   * @return array
   *   An associative array of webform wizard pages.
   *
   * @see \Drupal\webform\Entity\WebformSubmission
   */
  public function getPages($operation = '', WebformSubmissionInterface $webform_submission = NULL);

  /**
   * Get webform wizard page.
   *
   * @param string $operation
   *   Operation being performed.
   * @param string|int $key
   *   The name/key of a webform wizard page.
   *
   * @return array|null
   *   A webform wizard page element.
   */
  public function getPage($operation, $key);

  /**
   * Update submit and confirm paths (i.e. URL aliases) associated with this webform.
   */
  public function updatePaths();

  /**
   * Update submit and confirm paths associated with this webform.
   */
  public function deletePaths();

  /****************************************************************************/

  // Handler plugins.

  /****************************************************************************/

  /**
   * Determine if the webform has any message handlers.
   *
   * @return bool
   *   TRUE if the webform has any message handlers.
   */
  public function hasMessageHandler();

  /**
   * Determine if a webform handler requires anonymous submission tracking.
   *
   * @return bool
   *   TRUE if a webform handler requires anonymous submission tracking.
   *
   * @see \Drupal\webform_options_limit\Plugin\WebformHandler\OptionsLimitWebformHandler
   */
  public function hasAnonymousSubmissionTrackingHandler();

  /**
   * Returns a specific webform handler.
   *
   * @param string $handler_id
   *   The webform handler ID.
   *
   * @return \Drupal\webform\Plugin\WebformHandlerInterface
   *   The webform handler object.
   */
  public function getHandler($handler_id);

  /**
   * Returns the webform handlers for this webform.
   *
   * @param string $plugin_id
   *   (optional) Plugin id used to return specific plugin instances
   *   (i.e. handlers).
   * @param bool $status
   *   (optional) Status used to return enabled or disabled plugin instances
   *   (i.e. handlers).
   * @param int $results
   *   (optional) Value indicating if webform submissions are saved to internal
   *   or external system.
   * @param int $submission
   *   (optional) Value indicating if webform submissions must be saved to the
   *   database.
   *
   * @return \Drupal\webform\Plugin\WebformHandlerPluginCollection|\Drupal\webform\Plugin\WebformHandlerInterface[]
   *   The webform handler plugin collection.
   */
  public function getHandlers($plugin_id = NULL, $status = NULL, $results = NULL, $submission = NULL);

  /**
   * Saves a webform handler for this webform.
   *
   * @param \Drupal\webform\Plugin\WebformHandlerInterface $handler
   *   The webform handler object.
   *
   * @return string
   *   The webform handler ID.
   */
  public function addWebformHandler(WebformHandlerInterface $handler);

  /**
   * Update a webform handler for this webform.
   *
   * @param \Drupal\webform\Plugin\WebformHandlerInterface $handler
   *   The webform handler object.
   *
   * @return $this
   */
  public function updateWebformHandler(WebformHandlerInterface $handler);

  /**
   * Deletes a webform handler from this webform.
   *
   * @param \Drupal\webform\Plugin\WebformHandlerInterface $handler
   *   The webform handler object.
   *
   * @return $this
   */
  public function deleteWebformHandler(WebformHandlerInterface $handler);

  /**
   * Invoke a handlers method.
   *
   * @param string $method
   *   The handler method to be invoked.
   * @param mixed $data
   *   The argument to passed by reference to the handler method.
   * @param mixed $context1
   *   (optional) An additional variable that is passed by reference.
   * @param mixed $context2
   *   (optional) An additional variable that is passed by reference.
   * @param mixed $context3
   *   (optional) An additional variable that is passed by reference.
   *
   * @return \Drupal\Core\Access\AccessResult|null
   *   If 'access' method is invoked an AccessResult is returned.
   */
  public function invokeHandlers($method, &$data, &$context1 = NULL, &$context2 = NULL, &$context3 = NULL);

  /****************************************************************************/

  // Element plugins.

  /****************************************************************************/

  /**
   * Invoke elements method.
   *
   * @param string $method
   *   The handler method to be invoked.
   * @param mixed $data
   *   The argument to passed by reference to the handler method.
   * @param mixed $context1
   *   (optional) An additional variable that is passed by reference.
   * @param mixed $context2
   *   (optional) An additional variable that is passed by reference.
   */
  public function invokeElements($method, &$data, &$context1 = NULL, &$context2 = NULL);

  /****************************************************************************/

  // Variant plugins.

  /****************************************************************************/

  /**
   * Determine if a specific webform variant exists.
   *
   * @param string $variant_id
   *   The webform variant ID.
   *
   * @return bool
   *   TRUE if a specific webform variant exists.
   */
  public function hasVariant($variant_id);

  /**
   * Returns a specific webform variant.
   *
   * @param string $variant_id
   *   The webform variant ID.
   *
   * @return \Drupal\webform\Plugin\WebformVariantInterface
   *   The webform variant object.
   */
  public function getVariant($variant_id);

  /**
   * Returns the webform variants for this webform.
   *
   * @param string $plugin_id
   *   (optional) Plugin id used to return specific plugin instances
   *   (i.e. variants).
   * @param bool $status
   *   (optional) Status used to return enabled or disabled plugin instances
   *   (i.e. variants).
   * @param bool $element_key
   *   (optional) Element key used to return enabled or disabled plugin instances
   *   (i.e. variants).
   *
   * @return \Drupal\webform\Plugin\WebformVariantPluginCollection|\Drupal\webform\Plugin\WebformVariantInterface[]
   *   The webform variant plugin collection.
   */
  public function getVariants($plugin_id = NULL, $status = NULL, $element_key = NULL);

  /**
   * Saves a webform variant for this webform.
   *
   * @param \Drupal\webform\Plugin\WebformVariantInterface $variant
   *   The webform variant object.
   *
   * @return string
   *   The webform variant ID.
   */
  public function addWebformVariant(WebformVariantInterface $variant);

  /**
   * Update a webform variant for this webform.
   *
   * @param \Drupal\webform\Plugin\WebformVariantInterface $variant
   *   The webform variant object.
   *
   * @return $this
   */
  public function updateWebformVariant(WebformVariantInterface $variant);

  /**
   * Deletes a webform variant from this webform.
   *
   * @param \Drupal\webform\Plugin\WebformVariantInterface $variant
   *   The webform variant object.
   *
   * @return $this
   */
  public function deleteWebformVariant(WebformVariantInterface $variant);

  /**
   * Apply webform variants based on a webform submission or parameter.
   *
   * @param \Drupal\webform\WebformSubmissionInterface $webform_submission
   *   A webform submission.
   * @param array $variants
   *   An associative array of variant element keys and variant ids.
   * @param bool $force
   *   Apply disabled variants. Defaults to FALSE.
   *
   * @throws \Exception
   *   Throws exception if submission was not created using this webform.
   */
  public function applyVariants(WebformSubmissionInterface $webform_submission = NULL, array $variants = [], $force = FALSE);

  /**
   * Get variants data from a webform submission.
   *
   * @param \Drupal\webform\WebformSubmissionInterface $webform_submission
   *   A webform submission.
   *
   * @return array
   *   A associative array containing the variant element keys
   *   and variant value.
   */
  public function getVariantsData(WebformSubmissionInterface $webform_submission);

  /****************************************************************************/

  // Revisions.

  /****************************************************************************/

  /**
   * Required to allow webform which are config entities to have an EntityViewBuilder.
   *
   * Prevents:
   *   Fatal error: Call to undefined method
   *   Drupal\webform\Entity\Webform::isDefaultRevision()
   *   in /private/var/www/sites/d8_dev/core/lib/Drupal/Core/Entity/EntityViewBuilder.php
   *   on line 169
   *
   * @see \Drupal\Core\Entity\RevisionableInterface::isDefaultRevision()
   *
   * @return bool
   *   Always return TRUE since config entities are not revisionable.
   */
  public function isDefaultRevision();

  /****************************************************************************/

  // State data.

  /****************************************************************************/

  /**
   * Returns the stored value for a given key in the webform's state.
   *
   * @param string $key
   *   The key of the data to retrieve.
   * @param mixed $default
   *   The default value to use if the key is not found.
   *
   * @return mixed
   *   The stored value, or NULL if no value exists.
   */
  public function getState($key, $default = NULL);

  /**
   * Saves a value for a given key in the webform's state.
   *
   * @param string $key
   *   The key of the data to store.
   * @param mixed $value
   *   The data to store.
   */
  public function setState($key, $value);

  /**
   * Deletes an item from the webform's state.
   *
   * @param string $key
   *   The item name to delete.
   */
  public function deleteState($key);

  /**
   * Determine if the stored value for a given key exists in the webform's state.
   *
   * @param string $key
   *   The key of the data to retrieve.
   *
   * @return bool
   *   TRUE if the stored value for a given key exists.
   */
  public function hasState($key);

  /****************************************************************************/

  // User data.

  /****************************************************************************/

  /**
   * Returns the stored value for a given key in the webform's user data.
   *
   * @param string $key
   *   The key of the data to retrieve.
   * @param mixed $default
   *   The default value to use if the key is not found.
   *
   * @return mixed
   *   The stored value, or NULL if no value exists.
   */
  public function getUserData($key, $default = NULL);

  /**
   * Saves a value for a given key in the webform's user data.
   *
   * @param string $key
   *   The key of the data to store.
   * @param mixed $value
   *   The data to store.
   */
  public function setUserData($key, $value);

  /**
   * Deletes an item from the webform's user data.
   *
   * @param string $key
   *   The item name to delete.
   */
  public function deleteUserData($key);

  /**
   * Determine if the stored value for a given key exists in the webform's user data.
   *
   * @param string $key
   *   The key of the data to retrieve.
   *
   * @return bool
   *   TRUE if the stored value for a given key exists.
   */
  public function hasUserData($key);

  /****************************************************************************/

  // Third party settings.

  /****************************************************************************/

  /**
   * Unsets all third-party settings of a given module.
   *
   * @param string $module
   *   The module providing the third-party settings.
   */
  public function unsetThirdPartySettings($module);

}

Members

Namesort descending Modifiers Type Description Overrides
AccessibleInterface::access public function Checks data value access. 9
CacheableDependencyInterface::getCacheContexts public function The cache contexts associated with this object. 34
CacheableDependencyInterface::getCacheMaxAge public function The maximum age for which this object may be cached. 34
CacheableDependencyInterface::getCacheTags public function The cache tags associated with this object. 27
ConfigEntityInterface::calculateDependencies public function Calculates dependencies and stores them in the dependency property. 2
ConfigEntityInterface::disable public function Disables the configuration entity. 2
ConfigEntityInterface::enable public function Enables the configuration entity. 2
ConfigEntityInterface::get public function Returns the value of a property. 2
ConfigEntityInterface::getDependencies public function Gets the configuration dependencies. 2
ConfigEntityInterface::hasTrustedData public function Gets whether on not the data is trusted. 2
ConfigEntityInterface::isInstallable public function Checks whether this entity is installable. 2
ConfigEntityInterface::isUninstalling public function Returns whether this entity is being changed during the uninstall process. 2
ConfigEntityInterface::onDependencyRemoval public function Informs the entity that entities it depends on will be deleted. 2
ConfigEntityInterface::set public function Sets the value of a property. 2
ConfigEntityInterface::status public function Returns whether the configuration entity is enabled. 2
ConfigEntityInterface::trustData public function Sets that the data should be trusted. 2
EntityInterface::bundle public function Gets the bundle of the entity. 2
EntityInterface::create public static function Constructs a new entity object, without permanently saving it. 2
EntityInterface::createDuplicate public function Creates a duplicate of the entity. 2
EntityInterface::delete public function Deletes an entity permanently. 2
EntityInterface::enforceIsNew public function Enforces an entity to be new. 2
EntityInterface::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. 2
EntityInterface::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. 2
EntityInterface::getConfigDependencyName public function Gets the configuration dependency name. 2
EntityInterface::getConfigTarget public function Gets the configuration target identifier for the entity. 2
EntityInterface::getEntityType public function Gets the entity type definition. 2
EntityInterface::getEntityTypeId public function Gets the ID of the type of the entity. 2
EntityInterface::getOriginalId public function Gets the original ID. 2
EntityInterface::getTypedData public function Gets a typed data object for this entity object. 2
EntityInterface::hasLinkTemplate public function Indicates if a link template exists for a given key. 2
EntityInterface::id public function Gets the identifier. 2
EntityInterface::isNew public function Determines whether the entity is new. 2
EntityInterface::label public function Gets the label of the entity. 2
EntityInterface::language public function Gets the language of the entity. 2
EntityInterface::link Deprecated public function Deprecated way of generating a link to the entity. See toLink(). 2
EntityInterface::load public static function Loads an entity. 2
EntityInterface::loadMultiple public static function Loads one or more entities. 2
EntityInterface::postCreate public function Acts on a created entity before hooks are invoked. 2
EntityInterface::postDelete public static function Acts on deleted entities before the delete hook is invoked. 2
EntityInterface::postLoad public static function Acts on loaded entities. 3
EntityInterface::postSave public function Acts on a saved entity before the insert or update hook is invoked. 2
EntityInterface::preCreate public static function Changes the values of an entity before it is created. 2
EntityInterface::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. 2
EntityInterface::preSave public function Acts on an entity before the presave hook is invoked. 2
EntityInterface::referencedEntities public function Gets a list of entities referenced by this entity. 2
EntityInterface::save public function Saves an entity permanently. 2
EntityInterface::setOriginalId public function Sets the original ID. 2
EntityInterface::toArray public function Gets an array of all property values. 3
EntityInterface::toLink public function Generates the HTML for a link to this entity. 2
EntityInterface::toUrl public function Gets the URL object for the entity. 2
EntityInterface::uriRelationships public function Gets a list of URI relationships supported by this entity. 2
EntityInterface::url Deprecated public function Gets the public URL for this entity. 2
EntityInterface::urlInfo Deprecated public function Gets the URL object for the entity. 2
EntityInterface::uuid public function Gets the entity UUID (Universally Unique Identifier). 2
EntityOwnerInterface::getOwner public function Returns the entity owner's user entity. 1
EntityOwnerInterface::getOwnerId public function Returns the entity owner's user ID. 1
EntityOwnerInterface::setOwner public function Sets the entity owner's user entity. 1
EntityOwnerInterface::setOwnerId public function Sets the entity owner's user ID. 1
ObjectWithPluginCollectionInterface::getPluginCollections public function Gets the plugin collections used by this object. 11
RefinableCacheableDependencyInterface::addCacheableDependency public function Adds a dependency on an object: merges its cacheability metadata. 1
RefinableCacheableDependencyInterface::addCacheContexts public function Adds cache contexts. 1
RefinableCacheableDependencyInterface::addCacheTags public function Adds cache tags. 1
RefinableCacheableDependencyInterface::mergeCacheMaxAge public function Merges the maximum age (in seconds) with the existing maximum age. 1
SynchronizableInterface::isSyncing public function Returns whether this entity is being changed as part of a synchronization. 1
SynchronizableInterface::setSyncing public function Sets the status of the synchronization flag. 1
ThirdPartySettingsInterface::getThirdPartyProviders public function Gets the list of third parties that store information. 5
ThirdPartySettingsInterface::getThirdPartySetting public function Gets the value of a third-party setting. 5
ThirdPartySettingsInterface::getThirdPartySettings public function Gets all third-party settings of a given module. 5
ThirdPartySettingsInterface::setThirdPartySetting public function Sets the value of a third-party setting. 5
ThirdPartySettingsInterface::unsetThirdPartySetting public function Unsets a third-party setting. 5
WebformInterface::ACCESS_DENIED_DEFAULT constant Display standard 403 access denied page.
WebformInterface::ACCESS_DENIED_LOGIN constant Redirect to user login with custom message.
WebformInterface::ACCESS_DENIED_MESSAGE constant Display customized access denied message.
WebformInterface::ACCESS_DENIED_PAGE constant Display customized 403 access denied page.
WebformInterface::addWebformHandler public function Saves a webform handler for this webform. 1
WebformInterface::addWebformVariant public function Saves a webform variant for this webform. 1
WebformInterface::applyVariants public function Apply webform variants based on a webform submission or parameter. 1
WebformInterface::CONFIRMATION_DEFAULT constant Webform confirmation default.
WebformInterface::CONFIRMATION_INLINE constant Webform confirmation inline.
WebformInterface::CONFIRMATION_MESSAGE constant Webform confirmation message.
WebformInterface::CONFIRMATION_MODAL constant Webform confirmation modal.
WebformInterface::CONFIRMATION_NONE constant Webform confirmation none.
WebformInterface::CONFIRMATION_PAGE constant Webform confirmation page.
WebformInterface::CONFIRMATION_URL constant Webform confirmation URL.
WebformInterface::CONFIRMATION_URL_MESSAGE constant Webform confirmation URL with message.
WebformInterface::deleteElement public function Remove an element. 1
WebformInterface::deletePaths public function Update submit and confirm paths associated with this webform. 1
WebformInterface::deleteState public function Deletes an item from the webform's state. 1
WebformInterface::deleteUserData public function Deletes an item from the webform's user data. 1
WebformInterface::deleteWebformHandler public function Deletes a webform handler from this webform. 1
WebformInterface::deleteWebformVariant public function Deletes a webform variant from this webform. 1
WebformInterface::DRAFT_ALL constant Denote drafts are allowed for authenticated and anonymous users.
WebformInterface::DRAFT_AUTHENTICATED constant Denote drafts are allowed for authenticated users only.
WebformInterface::DRAFT_NONE constant Denote drafts are not allowed.
WebformInterface::getAccessRules public function Returns the webform access rules. 1
WebformInterface::getAssets public function Returns the webform's global and custom CSS and JavaScript assets. 1
WebformInterface::getCss public function Returns the webform's CSS. 1
WebformInterface::getDefaultSettings public static function Returns the webform default settings. 1
WebformInterface::getDescription public function Returns the webform's description. 1
WebformInterface::getElement public function Get a webform's initialized element. 1
WebformInterface::getElementDecoded public function Get a webform's raw (uninitialized) element. 1
WebformInterface::getElementsAttachments public function Get webform attachment elements. 1
WebformInterface::getElementsComputed public function Get webform computed elements. 1
WebformInterface::getElementsDecoded public function Get webform elements decoded as an associative array. 1
WebformInterface::getElementsDecodedAndFlattened public function Get webform raw elements decoded and flattened into an associative array. 1
WebformInterface::getElementsDefaultData public function Get webform elements default data. 1
WebformInterface::getElementsInitialized public function Get webform elements initialized as an associative array. 1
WebformInterface::getElementsInitializedAndFlattened public function Get webform elements initialized and flattened into an associative array. 1
WebformInterface::getElementsInitializedFlattenedAndHasValue public function Get webform flattened list of elements. 1
WebformInterface::getElementsManagedFiles public function Get webform managed file elements. 1
WebformInterface::getElementsOriginalDecoded public function Get original elements decoded as an associative array. 1
WebformInterface::getElementsOriginalRaw public function Get original elements (YAML) value. 1
WebformInterface::getElementsPrepopulate public function Get webform elements that can be prepopulated. 1
WebformInterface::getElementsRaw public function Get elements (YAML) value. 1
WebformInterface::getElementsSelectorOptions public function Get webform element's selectors as options. 1
WebformInterface::getElementsSelectorSourceValues public function Get webform element options as autocomplete source values. 1
WebformInterface::getElementsVariant public function Get webform variant elements. 1
WebformInterface::getHandler public function Returns a specific webform handler. 1
WebformInterface::getHandlers public function Returns the webform handlers for this webform. 1
WebformInterface::getJavaScript public function Returns the webform's JavaScript. 1
WebformInterface::getLangcode public function Returns the webform's (original) langcode. 1
WebformInterface::getNumberOfActions public function Get the number of actions (aka submit buttons). 1
WebformInterface::getNumberOfWizardPages public function Get the number of wizard pages. 1
WebformInterface::getOperation public function Returns the webform's current operation. 1
WebformInterface::getPage public function Get webform wizard page. 1
WebformInterface::getPages public function Get webform wizard pages. 1
WebformInterface::getSetting public function Returns the webform settings for a given key. 1
WebformInterface::getSettings public function Returns the webform settings. 1
WebformInterface::getState public function Returns the stored value for a given key in the webform's state. 1
WebformInterface::getSubmissionForm public function Get webform submission webform. 1
WebformInterface::getUserData public function Returns the stored value for a given key in the webform's user data. 1
WebformInterface::getVariant public function Returns a specific webform variant. 1
WebformInterface::getVariants public function Returns the webform variants for this webform. 1
WebformInterface::getVariantsData public function Get variants data from a webform submission. 1
WebformInterface::getWeight public function Returns the webform's weight. 1
WebformInterface::hasActions public function Determine if the webform has any custom actions (aka submit buttons). 1
WebformInterface::hasAnonymousSubmissionTrackingHandler public function Determine if a webform handler requires anonymous submission tracking. 1
WebformInterface::hasAttachments public function Determine if the webform's elements include attachments. 1
WebformInterface::hasComputed public function Determine if the webform's elements include computed values. 1
WebformInterface::hasConditions public function Determine if the webform has conditional logic (i.e. #states). 1
WebformInterface::hasContainer public function Determine if the webform has any containers. 1
WebformInterface::hasFlexboxLayout public function Determine if the webform is using a Flexbox layout. 1
WebformInterface::hasManagedFile public function Determine if the webform's elements include a managed_file upload element. 1
WebformInterface::hasMessageHandler public function Determine if the webform has any message handlers. 1
WebformInterface::hasPage public function Determine if the webform has page or is attached to other entities. 1
WebformInterface::hasPreview public function Determine if the webform has preview page. 1
WebformInterface::hasRemoteAddr public function Determine if remote IP address is being stored. 1
WebformInterface::hasRequired public function Determine if the webform has required elements. 1
WebformInterface::hasState public function Determine if the stored value for a given key exists in the webform's state. 1
WebformInterface::hasSubmissionLog public function Determine if submissions are being logged. 1
WebformInterface::hasSubmissions public function Checks if a webform has submissions. 1
WebformInterface::hasTranslations public function Determine if the current webform is translated. 1
WebformInterface::hasUserData public function Determine if the stored value for a given key exists in the webform's user data. 1
WebformInterface::hasVariant public function Determine if a specific webform variant exists. 1
WebformInterface::hasVariants public function Determine if the webform's elements include variants. 1
WebformInterface::hasWizardPages public function Determine if the webform has multi-step form wizard pages. 1
WebformInterface::invokeElements public function Invoke elements method. 1
WebformInterface::invokeHandlers public function Invoke a handlers method. 1
WebformInterface::isArchived public function Returns the webform archive indicator. 1
WebformInterface::isClosed public function Returns the webform closed status indicator. 1
WebformInterface::isConfidential public function Returns the webform confidential indicator. 1
WebformInterface::isDefaultRevision public function Required to allow webform which are config entities to have an EntityViewBuilder. 1
WebformInterface::isOpen public function Returns the webform opened status indicator. 1
WebformInterface::isOpening public function Determines if the webform is currently closed but scheduled to open. 1
WebformInterface::isOverridden public function Returns the webform override status. 1
WebformInterface::isResultsDisabled public function Determine if the saving of submissions is disabled. 1
WebformInterface::isScheduled public function Returns the webform scheduled status indicator. 1
WebformInterface::isTemplate public function Returns the webform template indicator. 1
WebformInterface::isTest public function Determine if the webform is being tested. 1
WebformInterface::isUpdating public function Returns the webform updating status. 1
WebformInterface::PAGE_CONFIRMATION constant Wizard confirmation page.
WebformInterface::PAGE_PREVIEW constant Wizard preview page.
WebformInterface::PAGE_START constant Wizard start page.
WebformInterface::resetSettings public function Reset overridden settings to original settings. 1
WebformInterface::setAccessRules public function Sets the webform access rules. 1
WebformInterface::setCss public function Sets the webform's CSS. 1
WebformInterface::setDescription public function Sets a webform's description. 1
WebformInterface::setElementProperties public function Set element properties. 1
WebformInterface::setElements public function Sets elements (YAML) value. 1
WebformInterface::setJavaScript public function Sets the webform's JavaScript. 1
WebformInterface::setOperation public function Sets the webform's current operation . 1
WebformInterface::setOverride public function Sets the webform settings and properties override state. 1
WebformInterface::setPropertyOverride public function Sets the value of an overridden property. 1
WebformInterface::setSetting public function Sets a webform setting for a given key. 1
WebformInterface::setSettingOverride public function Sets a webform setting override for a given key. 1
WebformInterface::setSettings public function Sets the webform settings. 1
WebformInterface::setSettingsOverride public function Sets the webform settings override. 1
WebformInterface::setState public function Saves a value for a given key in the webform's state. 1
WebformInterface::setStatus public function Sets the status of the configuration entity. Overrides ConfigEntityInterface::setStatus 1
WebformInterface::setUpdating public function Sets the webform updating state. 1
WebformInterface::setUserData public function Saves a value for a given key in the webform's user data. 1
WebformInterface::STATUS_ARCHIVED constant Webform status archived.
WebformInterface::STATUS_CLOSED constant Webform status closed.
WebformInterface::STATUS_OPEN constant Webform status open.
WebformInterface::STATUS_SCHEDULED constant Webform status scheduled.
WebformInterface::TITLE_SOURCE_ENTITY constant Source entity title.
WebformInterface::TITLE_SOURCE_ENTITY_WEBFORM constant Both source entity and webform title.
WebformInterface::TITLE_WEBFORM constant Webform title.
WebformInterface::TITLE_WEBFORM_SOURCE_ENTITY constant Both webform and source entity title.
WebformInterface::unsetThirdPartySettings public function Unsets all third-party settings of a given module. 1
WebformInterface::updatePaths public function Update submit and confirm paths (i.e. URL aliases) associated with this webform. 1
WebformInterface::updateWebformHandler public function Update a webform handler for this webform. 1
WebformInterface::updateWebformVariant public function Update a webform variant for this webform. 1