You are here

public static function WebformSignature::validateWebformSignature in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Element/WebformSignature.php \Drupal\webform\Element\WebformSignature::validateWebformSignature()

Webform element validation handler for #type 'signature'.

File

src/Element/WebformSignature.php, line 90

Class

WebformSignature
Provides a webform element for entering a signature.

Namespace

Drupal\webform\Element

Code

public static function validateWebformSignature(&$element, FormStateInterface $form_state, &$complete_form) {
  $value = $element['#value'];
  if (!static::isSignatureValid($value)) {
    $t_args = [
      '@title' => isset($element['#title']) ? $element['#title'] : t('Form'),
    ];
    $form_state
      ->setError($element, t('@title contains an invalid signature.', $t_args));
  }
}