public static function FormElement::processPattern in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Render/Element/FormElement.php \Drupal\Core\Render\Element\FormElement::processPattern()
- 9 core/lib/Drupal/Core/Render/Element/FormElement.php \Drupal\Core\Render\Element\FormElement::processPattern()
#process callback for #pattern form element property.
Parameters
array $element: An associative array containing the properties and children of the generic input element.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
array $complete_form: The complete form structure.
Return value
array The processed element.
File
- core/
lib/ Drupal/ Core/ Render/ Element/ FormElement.php, line 117
Class
- FormElement
- Provides a base class for form element plugins.
Namespace
Drupal\Core\Render\ElementCode
public static function processPattern(&$element, FormStateInterface $form_state, &$complete_form) {
if (isset($element['#pattern']) && !isset($element['#attributes']['pattern'])) {
$element['#attributes']['pattern'] = $element['#pattern'];
$element['#element_validate'][] = [
static::class,
'validatePattern',
];
}
return $element;
}