You are here

abstract class WebformHandlerBase in Webform 8.5

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

Provides a base class for a webform handler.

Hierarchy

Expanded class hierarchy of WebformHandlerBase

See also

\Drupal\webform\Plugin\WebformHandlerInterface

\Drupal\webform\Plugin\WebformHandlerManager

\Drupal\webform\Plugin\WebformHandlerManagerInterface

Plugin API

12 files declare their use of WebformHandlerBase
ActionWebformHandler.php in src/Plugin/WebformHandler/ActionWebformHandler.php
BrokenWebformHandler.php in src/Plugin/WebformHandler/BrokenWebformHandler.php
DebugWebformHandler.php in src/Plugin/WebformHandler/DebugWebformHandler.php
EmailWebformHandler.php in src/Plugin/WebformHandler/EmailWebformHandler.php
ExampleWebformHandler.php in modules/webform_example_handler/src/Plugin/WebformHandler/ExampleWebformHandler.php

... See full list

File

src/Plugin/WebformHandlerBase.php, line 28

Namespace

Drupal\webform\Plugin
View source
abstract class WebformHandlerBase extends PluginBase implements WebformHandlerInterface {
  use WebformPluginSettingsTrait;

  /**
   * The webform.
   *
   * @var \Drupal\webform\WebformInterface
   */
  protected $webform = NULL;

  /**
   * The webform submission.
   *
   * @var \Drupal\webform\WebformSubmissionInterface
   */
  protected $webformSubmission = NULL;

  /**
   * The webform handler ID.
   *
   * @var string
   */
  protected $handler_id;

  /**
   * The webform handler label.
   *
   * @var string
   */
  protected $label;

  /**
   * The webform variant notes.
   *
   * @var string
   */
  protected $notes = '';

  /**
   * The webform handler status.
   *
   * @var bool
   */
  protected $status = 1;

  /**
   * The weight of the webform handler.
   *
   * @var int|string
   */
  protected $weight = '';

  /**
   * The webform handler's conditions.
   *
   * @var array
   */
  protected $conditions = [];

  /**
   * The webform handler's conditions result cache.
   *
   * @var array
   */
  protected $conditionsResultCache = [];

  /**
   * The configuration factory.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * The logger factory.
   *
   * @var \Drupal\Core\Logger\LoggerChannelFactoryInterface
   */
  protected $loggerFactory;

  /**
   * The webform submission storage.
   *
   * @var \Drupal\webform\WebformSubmissionStorageInterface
   */
  protected $submissionStorage;

  /**
   * The webform submission (server-side) conditions (#states) validator.
   *
   * @var \Drupal\webform\WebformSubmissionConditionsValidator
   */
  protected $conditionsValidator;

  /**
   * The webform token manager.
   *
   * @var \Drupal\webform\WebformTokenManagerInterface
   */
  protected $tokenManager;

  /**
   * Constructs a WebformHandlerBase object.
   *
   * 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.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory
   *   The logger factory.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The configuration factory.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity type manager.
   * @param \Drupal\webform\WebformSubmissionConditionsValidatorInterface $conditions_validator
   *   The webform submission conditions (#states) validator.
   *
   * @see \Drupal\webform\Entity\Webform::getHandlers
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, LoggerChannelFactoryInterface $logger_factory, ConfigFactoryInterface $config_factory, EntityTypeManagerInterface $entity_type_manager, WebformSubmissionConditionsValidatorInterface $conditions_validator) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->loggerFactory = $logger_factory;
    $this->configFactory = $config_factory;
    $this->submissionStorage = $entity_type_manager
      ->getStorage('webform_submission');
    $this->conditionsValidator = $conditions_validator;

    // @todo Webform 8.x-6.x: Properly inject the token manager.
    // @todo Webform 8.x-6.x: Update handlers that injects the token manager.
    $this->tokenManager = \Drupal::service('webform.token_manager');
    $this
      ->setConfiguration($configuration);
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('logger.factory'), $container
      ->get('config.factory'), $container
      ->get('entity_type.manager'), $container
      ->get('webform_submission.conditions_validator'));
  }

  /**
   * {@inheritdoc}
   */
  public function setWebform(WebformInterface $webform) {
    $this->webform = $webform;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getWebform() {
    return $this->webform;
  }

  /**
   * {@inheritdoc}
   */
  public function setWebformSubmission(WebformSubmissionInterface $webform_submission = NULL) {
    $this->webformSubmission = $webform_submission;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getWebformSubmission() {
    return $this->webformSubmission;
  }

  /**
   * {@inheritdoc}
   */
  public function getSummary() {
    return [
      '#theme' => 'webform_handler_' . $this->pluginId . '_summary',
      '#settings' => $this->configuration,
      '#handler' => $this,
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function label() {
    return $this
      ->getLabel();
  }

  /**
   * {@inheritdoc}
   */
  public function description() {
    return $this->pluginDefinition['description'];
  }

  /**
   * {@inheritdoc}
   */
  public function cardinality() {
    return $this->pluginDefinition['cardinality'];
  }

  /**
   * {@inheritdoc}
   */
  public function supportsConditions() {
    return $this->pluginDefinition['conditions'];
  }

  /**
   * {@inheritdoc}
   */
  public function supportsTokens() {
    return $this->pluginDefinition['tokens'];
  }

  /**
   * {@inheritdoc}
   */
  public function getHandlerId() {
    return $this->handler_id;
  }

  /**
   * {@inheritdoc}
   */
  public function setHandlerId($handler_id) {
    $this->handler_id = $handler_id;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function setLabel($label) {
    $this->label = $label;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getLabel() {
    return $this->label ?: $this->pluginDefinition['label'];
  }

  /**
   * {@inheritdoc}
   */
  public function setNotes($notes) {
    $this->notes = $notes;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getNotes() {
    return $this->notes;
  }

  /**
   * {@inheritdoc}
   */
  public function setStatus($status) {
    $this->status = $status;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getStatus() {
    return $this->status;
  }

  /**
   * {@inheritdoc}
   */
  public function setConditions(array $conditions) {
    $this->conditions = $conditions;
    $this->conditionsResultCache = [];
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getConditions() {
    return $this->conditions;
  }

  /**
   * {@inheritdoc}
   */
  public function setWeight($weight) {
    $this->weight = $weight;
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getWeight() {
    return $this->weight;
  }

  /**
   * {@inheritdoc}
   */
  public function enable() {
    return $this
      ->setStatus(TRUE);
  }

  /**
   * {@inheritdoc}
   */
  public function disable() {
    return $this
      ->setStatus(FALSE);
  }

  /**
   * {@inheritdoc}
   */
  public function isExcluded() {
    return $this->configFactory
      ->get('webform.settings')
      ->get('handler.excluded_handlers.' . $this->pluginDefinition['id']) ? TRUE : FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function isEnabled() {
    return $this->status ? TRUE : FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function isDisabled() {
    return !$this
      ->isEnabled();
  }

  /**
   * {@inheritdoc}
   */
  public function isApplicable(WebformInterface $webform) {
    return TRUE;
  }

  /**
   * {@inheritdoc}
   */
  public function isSubmissionOptional() {
    return $this->pluginDefinition['submission'] === WebformHandlerInterface::SUBMISSION_OPTIONAL;
  }

  /**
   * {@inheritdoc}
   */
  public function isSubmissionRequired() {
    return $this->pluginDefinition['submission'] === WebformHandlerInterface::SUBMISSION_REQUIRED;
  }

  /**
   * {@inheritdoc}
   */
  public function hasAnonymousSubmissionTracking() {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function checkConditions(WebformSubmissionInterface $webform_submission) {
    $hash = $webform_submission
      ->getDataHash();
    if (isset($this->conditionsResultCache[$hash])) {
      return $this->conditionsResultCache[$hash];
    }

    // Return TRUE if conditions are disabled for the handler.
    if (!$this
      ->supportsConditions()) {
      $this->conditionsResultCache[$hash] = TRUE;
      return TRUE;
    }
    $conditions = $this
      ->getConditions();

    // Return TRUE if no conditions are defined.
    if (empty($conditions)) {
      $this->conditionsResultCache[$hash] = TRUE;
      return TRUE;
    }

    // Get conditions.
    $state = key($conditions);
    $conditions = $conditions[$state];

    // Replace tokens in conditions.
    $conditions = $this
      ->replaceTokens($conditions, $webform_submission);

    // Validation conditions.
    $result = $this->conditionsValidator
      ->validateConditions($conditions, $webform_submission);

    // Negate result for 'disabled' state.
    $result = $state === 'disabled' ? !$result : $result;
    $this->conditionsResultCache[$hash] = $result;
    return $result;
  }

  /**
   * {@inheritdoc}
   */
  public function getConfiguration() {
    return [
      'id' => $this
        ->getPluginId(),
      'label' => $this
        ->getLabel(),
      'notes' => $this
        ->getNotes(),
      'handler_id' => $this
        ->getHandlerId(),
      'status' => $this
        ->getStatus(),
      'conditions' => $this
        ->getConditions(),
      'weight' => $this
        ->getWeight(),
      'settings' => $this->configuration,
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function setConfiguration(array $configuration) {
    $configuration += [
      'handler_id' => '',
      'label' => '',
      'notes' => '',
      'status' => 1,
      'conditions' => [],
      'weight' => '',
      'settings' => [],
    ];
    $this->configuration = $configuration['settings'] + $this
      ->defaultConfiguration();
    $this->handler_id = $configuration['handler_id'];
    $this->label = $configuration['label'];
    $this->notes = $configuration['notes'];
    $this->status = $configuration['status'];
    $this->conditions = $configuration['conditions'];
    $this->weight = $configuration['weight'];
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function getOffCanvasWidth() {
    return WebformDialogHelper::DIALOG_NORMAL;
  }

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * Apply submitted form state to configuration.
   *
   * This method can used to update configuration when the configuration form
   * is being rebuilt during an #ajax callback.
   *
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   */
  protected function applyFormStateToConfiguration(FormStateInterface $form_state) {
    $values = $form_state
      ->getValues();
    $default_configuration = $this
      ->defaultConfiguration();
    foreach ($values as $key => $value) {
      if (array_key_exists($key, $this->configuration)) {
        if (is_bool($default_configuration[$key])) {
          $this->configuration[$key] = (bool) $value;
        }
        elseif (is_int($default_configuration[$key])) {
          $this->configuration[$key] = (int) $value;
        }
        else {
          $this->configuration[$key] = $value;
        }
      }
    }
  }

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

  // Webform methods.

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

  /**
   * {@inheritdoc}
   */
  public function alterElements(array &$elements, WebformInterface $webform) {
  }

  /**
   * {@inheritdoc}
   */
  public function alterElement(array &$element, FormStateInterface $form_state, array $context) {
  }

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

  // Webform submission methods.

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

  /**
   * {@inheritdoc}
   */
  public function overrideSettings(array &$settings, WebformSubmissionInterface $webform_submission) {
  }

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

  // Submission form methods.

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

  /**
   * {@inheritdoc}
   */
  public function prepareForm(WebformSubmissionInterface $webform_submission, $operation, FormStateInterface $form_state) {
  }

  /**
   * {@inheritdoc}
   */
  public function alterForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
  }

  /**
   * {@inheritdoc}
   */
  public function confirmForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
  }

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

  // Submission methods.

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

  /**
   * {@inheritdoc}
   */
  public function preCreate(array &$values) {
  }

  /**
   * {@inheritdoc}
   */
  public function postCreate(WebformSubmissionInterface $webform_submission) {
  }

  /**
   * {@inheritdoc}
   */
  public function postLoad(WebformSubmissionInterface $webform_submission) {
  }

  /**
   * {@inheritdoc}
   */
  public function prePurge(array $webform_submissions) {
  }

  /**
   * {@inheritdoc}
   */
  public function postPurge(array $webform_submissions) {
  }

  /**
   * {@inheritdoc}
   */
  public function preDelete(WebformSubmissionInterface $webform_submission) {
  }

  /**
   * {@inheritdoc}
   */
  public function postDelete(WebformSubmissionInterface $webform_submission) {
  }

  /**
   * {@inheritdoc}
   */
  public function preSave(WebformSubmissionInterface $webform_submission) {
  }

  /**
   * {@inheritdoc}
   */
  public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {
  }

  /**
   * {@inheritdoc}
   */
  public function access(WebformSubmissionInterface $webform_submission, $operation, AccountInterface $account = NULL) {
    return AccessResult::neutral();
  }

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

  // Preprocessing methods.

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

  /**
   * {@inheritdoc}
   */
  public function preprocessConfirmation(array &$variables) {
  }

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

  // Handler methods.

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

  /**
   * {@inheritdoc}
   */
  public function createHandler() {
  }

  /**
   * {@inheritdoc}
   */
  public function updateHandler() {
  }

  /**
   * {@inheritdoc}
   */
  public function deleteHandler() {
  }

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

  // Element methods.

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

  /**
   * {@inheritdoc}
   */
  public function accessElement(array &$element, $operation, AccountInterface $account = NULL) {
    return AccessResult::neutral();
  }

  /**
   * {@inheritdoc}
   */
  public function createElement($key, array $element) {
  }

  /**
   * {@inheritdoc}
   */
  public function updateElement($key, array $element, array $original_element) {
  }

  /**
   * {@inheritdoc}
   */
  public function deleteElement($key, array $element) {
  }

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

  // Form helper methods.

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

  /**
   * Set configuration settings parents.
   *
   * This helper method looks looks for the handler default configuration keys
   * within a form and set a matching element's #parents property to
   * ['settings', '{element_key}']
   *
   * @param array $elements
   *   An array of form elements.
   *
   * @return array
   *   Form element with #parents set.
   */
  protected function setSettingsParents(array &$elements) {
    return $this
      ->setSettingsParentsRecursively($elements);
  }

  /**
   * Set configuration settings parents.
   *
   * This helper method looks looks for the handler default configuration keys
   * within a form and set a matching element's #parents property to
   * ['settings', '{element_key}']
   *
   * @param array $elements
   *   An array of form elements.
   *
   * @return array
   *   Form element with #parents set.
   */
  protected function setSettingsParentsRecursively(array &$elements) {
    $default_configuration = $this
      ->defaultConfiguration();
    foreach ($elements as $element_key => &$element) {

      // Only a form element can have #parents.
      if (!WebformElementHelper::isElement($element, $element_key)) {
        continue;
      }

      // If the element has #parents property assume that it has also been
      // defined for all sub-elements.
      if (isset($element['#parents'])) {
        continue;
      }

      // Only set #parents when #element has…
      // - Default configuration.
      // - Is an input.
      // - #default_value or #value (aka input).
      // - Not a container with children.
      if (array_key_exists($element_key, $default_configuration) && isset($element['#type']) && !WebformElementHelper::hasChildren($element)) {
        $element['#parents'] = [
          'settings',
          $element_key,
        ];
      }
      else {
        $this
          ->setSettingsParentsRecursively($element);
      }
    }
    return $elements;
  }

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

  // Token methods.

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

  /**
   * Replace tokens in text with no render context.
   *
   * @param string|array $text
   *   A string of text that may contain tokens.
   * @param \Drupal\Core\Entity\EntityInterface|null $entity
   *   A Webform or Webform submission entity.
   * @param array $data
   *   (optional) An array of keyed objects.
   * @param array $options
   *   (optional) A keyed array of settings and flags to control the token
   *   replacement process. Supported options are:
   *   - langcode: A language code to be used when generating locale-sensitive
   *     tokens.
   *   - callback: A callback function that will be used to post-process the
   *     array of token replacements after they are generated.
   *   - clear: A boolean flag indicating that tokens should be removed from the
   *     final text if no replacement value can be generated.
   *
   * @return string|array
   *   Text or array with tokens replaced.
   */
  protected function replaceTokens($text, EntityInterface $entity = NULL, array $data = [], array $options = []) {
    return $this->tokenManager
      ->replaceNoRenderContext($text, $entity, $data, $options);
  }

  /**
   * Build token tree element.
   *
   * @param array $token_types
   *   (optional) An array containing token types that should be shown in the tree.
   * @param string $description
   *   (optional) Description to appear after the token tree link.
   *
   * @return array
   *   A render array containing a token tree link wrapped in a div.
   */
  protected function buildTokenTreeElement(array $token_types = [
    'webform',
    'webform_submission',
  ], $description = NULL) {
    return $this->tokenManager
      ->buildTreeElement($token_types, $description);
  }

  /**
   * Validate form that should have tokens in it.
   *
   * @param array $form
   *   A form.
   * @param array $token_types
   *   An array containing token types that should be validated.
   *
   * @see token_element_validate()
   */
  protected function elementTokenValidate(array &$form, array $token_types = [
    'webform',
    'webform_submission',
    'webform_handler',
  ]) {
    return $this->tokenManager
      ->elementValidate($form, $token_types);
  }

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

  // Logging methods.

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

  /**
   * Get webform or webform_submission logger.
   *
   * @param string $channel
   *   The logger channel. Defaults to 'webform'.
   *
   * @return \Drupal\Core\Logger\LoggerChannelInterface
   *   Webform logger
   */
  protected function getLogger($channel = 'webform') {
    return $this->loggerFactory
      ->get($channel);
  }

  /**
   * Log a webform handler's submission operation.
   *
   * @param \Drupal\webform\WebformSubmissionInterface $webform_submission
   *   A webform submission.
   * @param string $operation
   *   The operation to be logged.
   * @param string $message
   *   The message to be logged.
   * @param array $data
   *   The data to be saved with log record.
   *
   * @deprecated Instead call the 'webform_submission' logger channel directly.
   *
   *  $message = 'Some message with an %argument.'
   *  $context = [
   *    '%argument' => 'Some value'
   *    'link' => $webform_submission->toLink($this->t('Edit'), 'edit-form')->toString(),
   *    'webform_submission' => $webform_submission,
   *    'handler_id' => NULL,
   *    'data' => [],
   *  ];
   *  \Drupal::logger('webform_submission')->notice($message, $context);
   */
  protected function log(WebformSubmissionInterface $webform_submission, $operation, $message = '', array $data = []) {
    if ($webform_submission
      ->getWebform()
      ->hasSubmissionLog()) {
      $this->submissionStorage
        ->log($webform_submission, [
        'handler_id' => $this
          ->getHandlerId(),
        'operation' => $operation,
        'message' => $message,
        'data' => $data,
      ]);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
WebformHandlerBase::$conditions protected property The webform handler's conditions.
WebformHandlerBase::$conditionsResultCache protected property The webform handler's conditions result cache.
WebformHandlerBase::$conditionsValidator protected property The webform submission (server-side) conditions (#states) validator.
WebformHandlerBase::$configFactory protected property The configuration factory. 1
WebformHandlerBase::$handler_id protected property The webform handler ID.
WebformHandlerBase::$label protected property The webform handler label.
WebformHandlerBase::$loggerFactory protected property The logger factory.
WebformHandlerBase::$notes protected property The webform variant notes.
WebformHandlerBase::$status protected property The webform handler status.
WebformHandlerBase::$submissionStorage protected property The webform submission storage.
WebformHandlerBase::$tokenManager protected property The webform token manager. 6
WebformHandlerBase::$webform protected property The webform.
WebformHandlerBase::$webformSubmission protected property The webform submission.
WebformHandlerBase::$weight protected property The weight of the webform handler.
WebformHandlerBase::access public function Controls entity operation access to webform submission. Overrides WebformHandlerInterface::access 1
WebformHandlerBase::accessElement public function Controls entity operation access to webform submission element. Overrides WebformHandlerInterface::accessElement 1
WebformHandlerBase::alterElement public function Alter webform element. Overrides WebformHandlerInterface::alterElement 2
WebformHandlerBase::alterElements public function Alter webform submission webform elements. Overrides WebformHandlerInterface::alterElements 2
WebformHandlerBase::alterForm public function Alter webform submission form. Overrides WebformHandlerInterface::alterForm 3
WebformHandlerBase::applyFormStateToConfiguration protected function Apply submitted form state to configuration.
WebformHandlerBase::buildConfigurationForm public function Form constructor. Overrides PluginFormInterface::buildConfigurationForm 9
WebformHandlerBase::buildTokenTreeElement protected function Build token tree element. 2
WebformHandlerBase::cardinality public function Returns the webform handler cardinality settings. Overrides WebformHandlerInterface::cardinality
WebformHandlerBase::checkConditions public function Check handler conditions against a webform submission. Overrides WebformHandlerInterface::checkConditions
WebformHandlerBase::confirmForm public function Confirm webform submission form. Overrides WebformHandlerInterface::confirmForm 2
WebformHandlerBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create 7
WebformHandlerBase::createElement public function Acts on a element after it has been created. Overrides WebformHandlerInterface::createElement 2
WebformHandlerBase::createHandler public function Acts on handler after it has been created and added to webform. Overrides WebformHandlerInterface::createHandler 2
WebformHandlerBase::defaultConfiguration public function Gets default configuration for this plugin. Overrides ConfigurableInterface::defaultConfiguration 9
WebformHandlerBase::deleteElement public function Acts on a element after it has been deleted. Overrides WebformHandlerInterface::deleteElement 2
WebformHandlerBase::deleteHandler public function Acts on handler after it has been removed. Overrides WebformHandlerInterface::deleteHandler 3
WebformHandlerBase::description public function Returns the webform handler description. Overrides WebformHandlerInterface::description
WebformHandlerBase::disable public function Disables the webform handler. Overrides WebformHandlerInterface::disable
WebformHandlerBase::elementTokenValidate protected function Validate form that should have tokens in it.
WebformHandlerBase::enable public function Enables the webform handler. Overrides WebformHandlerInterface::enable
WebformHandlerBase::getConditions public function Returns the conditions the webform handler. Overrides WebformHandlerInterface::getConditions
WebformHandlerBase::getConfiguration public function Gets this plugin's configuration. Overrides ConfigurableInterface::getConfiguration
WebformHandlerBase::getHandlerId public function Returns the unique ID representing the webform handler. Overrides WebformHandlerInterface::getHandlerId
WebformHandlerBase::getLabel public function Returns the label of the webform handler. Overrides WebformHandlerInterface::getLabel
WebformHandlerBase::getLogger protected function Get webform or webform_submission logger.
WebformHandlerBase::getNotes public function Returns notes of the webform variant. Overrides WebformHandlerInterface::getNotes
WebformHandlerBase::getOffCanvasWidth public function Get configuration form's off-canvas width. Overrides WebformHandlerInterface::getOffCanvasWidth 1
WebformHandlerBase::getStatus public function Returns the status of the webform handler. Overrides WebformHandlerInterface::getStatus
WebformHandlerBase::getSummary public function Returns a render array summarizing the configuration of the webform handler. Overrides WebformHandlerInterface::getSummary 8
WebformHandlerBase::getWebform public function Get the webform that this handler is attached to. Overrides WebformHandlerInterface::getWebform
WebformHandlerBase::getWebformSubmission public function Get the webform submission that this handler is handling. Overrides WebformHandlerInterface::getWebformSubmission
WebformHandlerBase::getWeight public function Returns the weight of the webform handler. Overrides WebformHandlerInterface::getWeight
WebformHandlerBase::hasAnonymousSubmissionTracking public function Determine if the webform handler requires anonymous submission tracking. Overrides WebformHandlerInterface::hasAnonymousSubmissionTracking 1
WebformHandlerBase::isApplicable public function Determine if this handle is applicable to the webform. Overrides WebformHandlerInterface::isApplicable
WebformHandlerBase::isDisabled public function Returns the webform handler disabled indicator. Overrides WebformHandlerInterface::isDisabled
WebformHandlerBase::isEnabled public function Returns the webform handler enabled indicator. Overrides WebformHandlerInterface::isEnabled 1
WebformHandlerBase::isExcluded public function Checks if the handler is excluded via webform.settings. Overrides WebformHandlerInterface::isExcluded
WebformHandlerBase::isSubmissionOptional public function Returns the webform submission is optional indicator. Overrides WebformHandlerInterface::isSubmissionOptional
WebformHandlerBase::isSubmissionRequired public function Returns the webform submission is required indicator. Overrides WebformHandlerInterface::isSubmissionRequired
WebformHandlerBase::label public function Returns the webform handler label. Overrides WebformHandlerInterface::label
WebformHandlerBase::log Deprecated protected function Log a webform handler's submission operation.
WebformHandlerBase::overrideSettings public function Alter/override a webform submission webform settings. Overrides WebformHandlerInterface::overrideSettings 3
WebformHandlerBase::postCreate public function Acts on a webform submission after it is created. Overrides WebformHandlerInterface::postCreate 2
WebformHandlerBase::postDelete public function Acts on deleted a webform submission before the delete hook is invoked. Overrides WebformHandlerInterface::postDelete 4
WebformHandlerBase::postLoad public function Acts on loaded webform submission. Overrides WebformHandlerInterface::postLoad 2
WebformHandlerBase::postPurge public function Acts on webform submissions after they are purged. Overrides WebformHandlerInterface::postPurge 1
WebformHandlerBase::postSave public function Acts on a saved webform submission before the insert or update hook is invoked. Overrides WebformHandlerInterface::postSave 5
WebformHandlerBase::preCreate public function Changes the values of an entity before it is created. Overrides WebformHandlerInterface::preCreate 2
WebformHandlerBase::preDelete public function Acts on a webform submission before they are deleted and before hooks are invoked. Overrides WebformHandlerInterface::preDelete 2
WebformHandlerBase::prepareForm public function Acts on an webform submission about to be shown on a webform submission form. Overrides WebformHandlerInterface::prepareForm
WebformHandlerBase::preprocessConfirmation public function Prepares variables for webform confirmation templates. Overrides WebformHandlerInterface::preprocessConfirmation 2
WebformHandlerBase::prePurge public function Acts on webform submissions before they are purged. Overrides WebformHandlerInterface::prePurge 1
WebformHandlerBase::preSave public function Acts on a webform submission before the presave hook is invoked. Overrides WebformHandlerInterface::preSave 2
WebformHandlerBase::replaceTokens protected function Replace tokens in text with no render context.
WebformHandlerBase::setConditions public function Sets the conditions for this webform handler. Overrides WebformHandlerInterface::setConditions
WebformHandlerBase::setConfiguration public function Sets the configuration for this plugin instance. Overrides ConfigurableInterface::setConfiguration 1
WebformHandlerBase::setHandlerId public function Sets the id for this webform handler. Overrides WebformHandlerInterface::setHandlerId
WebformHandlerBase::setLabel public function Sets the label for this webform handler. Overrides WebformHandlerInterface::setLabel
WebformHandlerBase::setNotes public function Set notes for this webform variant. Overrides WebformHandlerInterface::setNotes
WebformHandlerBase::setSettingsParents protected function Set configuration settings parents.
WebformHandlerBase::setSettingsParentsRecursively protected function Set configuration settings parents.
WebformHandlerBase::setStatus public function Sets the status for this webform handler. Overrides WebformHandlerInterface::setStatus
WebformHandlerBase::setWebform public function Set the webform that this is handler is attached to. Overrides WebformHandlerInterface::setWebform
WebformHandlerBase::setWebformSubmission public function Set the webform submission that this handler is handling. Overrides WebformHandlerInterface::setWebformSubmission
WebformHandlerBase::setWeight public function Sets the weight for this webform handler. Overrides WebformHandlerInterface::setWeight
WebformHandlerBase::submitConfigurationForm public function Form submission handler. Overrides PluginFormInterface::submitConfigurationForm 9
WebformHandlerBase::submitForm public function Submit webform submission form. Overrides WebformHandlerInterface::submitForm 4
WebformHandlerBase::supportsConditions public function Determine if webform handler supports conditions. Overrides WebformHandlerInterface::supportsConditions
WebformHandlerBase::supportsTokens public function Determine if webform handler supports tokens. Overrides WebformHandlerInterface::supportsTokens
WebformHandlerBase::updateElement public function Acts on a element after it has been updated. Overrides WebformHandlerInterface::updateElement 2
WebformHandlerBase::updateHandler public function Acts on handler after it has been updated. Overrides WebformHandlerInterface::updateHandler 3
WebformHandlerBase::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm 3
WebformHandlerBase::validateForm public function Validate webform submission form. Overrides WebformHandlerInterface::validateForm 2
WebformHandlerBase::__construct public function Constructs a WebformHandlerBase object. Overrides PluginBase::__construct 7
WebformHandlerInterface::CARDINALITY_SINGLE constant Value indicating a single plugin instances are permitted.
WebformHandlerInterface::CARDINALITY_UNLIMITED constant Value indicating unlimited plugin instances are permitted.
WebformHandlerInterface::RESULTS_IGNORED constant Value indicating webform submissions are not processed (i.e. email or saved) by the handler.
WebformHandlerInterface::RESULTS_PROCESSED constant Value indicating webform submissions are processed (i.e. email or saved) by the handler.
WebformHandlerInterface::SUBMISSION_OPTIONAL constant Value indicating webform submissions do not have to be stored in the database.
WebformHandlerInterface::SUBMISSION_REQUIRED constant Value indicating webform submissions must be stored in the database.
WebformPluginSettingsTrait::getSetting public function
WebformPluginSettingsTrait::getSettings public function
WebformPluginSettingsTrait::setSetting public function
WebformPluginSettingsTrait::setSettings public function