You are here

protected function OptionsBase::prepareElementValidateCallbacks in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/OptionsBase.php \Drupal\webform\Plugin\WebformElement\OptionsBase::prepareElementValidateCallbacks()

Prepare an element's validation callbacks.

Parameters

array $element: An element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

Overrides WebformElementBase::prepareElementValidateCallbacks

File

src/Plugin/WebformElement/OptionsBase.php, line 249

Class

OptionsBase
Provides a base 'options' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

protected function prepareElementValidateCallbacks(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
  if ($this
    ->hasMultipleValues($element)) {
    $element['#element_validate'][] = [
      get_class($this),
      'validateMultipleOptions',
    ];
  }
  parent::prepareElementValidateCallbacks($element, $webform_submission);
}