You are here

public static function WebformComputedBase::validateWebformComputed in Webform 8.5

Same name in this branch
  1. 8.5 src/Element/WebformComputedBase.php \Drupal\webform\Element\WebformComputedBase::validateWebformComputed()
  2. 8.5 src/Plugin/WebformElement/WebformComputedBase.php \Drupal\webform\Plugin\WebformElement\WebformComputedBase::validateWebformComputed()
Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/WebformComputedBase.php \Drupal\webform\Plugin\WebformElement\WebformComputedBase::validateWebformComputed()

Form API callback. Removes ignored element for $form_state values.

File

src/Plugin/WebformElement/WebformComputedBase.php, line 234

Class

WebformComputedBase
Provides a base class for 'webform_computed' elements.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public static function validateWebformComputed(array &$element, FormStateInterface $form_state, array &$completed_form) {
  if (empty($element['#store'])) {

    // Unset the value from the $form_state to prevent modules from relying
    // on this value.
    $key = $element['#webform_key'];
    $form_state
      ->unsetValue($key);
  }
}