You are here

public static function WebformTermsOfService::validateWebformTermsOfService in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Element/WebformTermsOfService.php \Drupal\webform\Element\WebformTermsOfService::validateWebformTermsOfService()

Webform element validation handler for webform terms of service element.

File

src/Element/WebformTermsOfService.php, line 132

Class

WebformTermsOfService
Provides a webform terms of service element.

Namespace

Drupal\webform\Element

Code

public static function validateWebformTermsOfService(&$element, FormStateInterface $form_state, &$complete_form) {
  $value = (bool) $form_state
    ->getValue($element['#parents'], []);
  $element['#value'] = $value;
  $form_state
    ->setValueForElement($element, $value);
}