if ($is_empty_multiple ||
$is_empty_string ||
$is_empty_value ||
$is_empty_null) { // Flag this element as #required_but_empty to allow #element_validate
// handlers to set a custom required error message, but without having
// to re-implement the complex logic to figure out whether the field
// value is empty.
$elements['#required_but_empty'
] = TRUE;
} } // Call user-defined form level validators.
if (isset($form_id)) { $this->
executeValidateHandlers($elements,
$form_state);
} // Call any element-specific validators. These must act on the element
// #value data.
elseif (isset($elements['#element_validate'
])) { foreach ($elements['#element_validate'
] as $callback) { $complete_form = &
$form_state->
getCompleteForm();
call_user_func_array($form_state->
prepareCallback($callback),
[&
$elements, &
$form_state, &
$complete_form]);
} } // Ensure that a #required form error is thrown, regardless of whether