protected function WebformElementBase::prepareElementValidateCallbacks in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElementBase.php \Drupal\webform\Plugin\WebformElementBase::prepareElementValidateCallbacks()
Prepare an element's validation callbacks.
Parameters
array $element: An element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
9 calls to WebformElementBase::prepareElementValidateCallbacks()
- Address::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ Address.php - Prepare an element's validation callbacks.
- DateBase::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ DateBase.php - Prepare an element's validation callbacks.
- EntityAutocomplete::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ EntityAutocomplete.php - Prepare an element's validation callbacks.
- Item::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ Item.php - Prepare an element's validation callbacks.
- OptionsBase::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ OptionsBase.php - Prepare an element's validation callbacks.
8 methods override WebformElementBase::prepareElementValidateCallbacks()
- Address::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ Address.php - Prepare an element's validation callbacks.
- DateBase::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ DateBase.php - Prepare an element's validation callbacks.
- EntityAutocomplete::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ EntityAutocomplete.php - Prepare an element's validation callbacks.
- Item::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ Item.php - Prepare an element's validation callbacks.
- OptionsBase::prepareElementValidateCallbacks in src/
Plugin/ WebformElement/ OptionsBase.php - Prepare an element's validation callbacks.
File
- src/
Plugin/ WebformElementBase.php, line 1060
Class
- WebformElementBase
- Provides a base class for a webform element.
Namespace
Drupal\webform\PluginCode
protected function prepareElementValidateCallbacks(array &$element, WebformSubmissionInterface $webform_submission = NULL) {
// Validation callbacks are only applicable to inputs.
if (!$this
->isInput($element)) {
return;
}
// Add webform element #minlength, #multiple, and/or #unique
// validation handler.
if (isset($element['#minlength'])) {
$element['#element_validate'][] = [
get_class($this),
'validateMinlength',
];
}
if (isset($element['#multiple']) && $element['#multiple'] > 1) {
$element['#element_validate'][] = [
get_class($this),
'validateMultiple',
];
}
if (isset($element['#unique']) && $webform_submission) {
$element['#element_validate'][] = [
get_class($this),
'validateUnique',
];
}
}