function FormElementBase::processPattern

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Render/Element/FormElementBase.php \Drupal\Core\Render\Element\FormElementBase::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.

1 method overrides FormElementBase::processPattern()
FormElement::processPattern in core/lib/Drupal/Core/Render/Element/FormElement.php
#process callback for #pattern form element property.

File

core/lib/Drupal/Core/Render/Element/FormElementBase.php, line 120

Class

FormElementBase
Provides a base class for form element plugins.

Namespace

Drupal\Core\Render\Element

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.