function RenderElementHelper::processElement

Same name in other branches
  1. 8.9.x core/modules/inline_form_errors/src/RenderElementHelper.php \Drupal\inline_form_errors\RenderElementHelper::processElement()
  2. 10 core/modules/inline_form_errors/src/RenderElementHelper.php \Drupal\inline_form_errors\RenderElementHelper::processElement()
  3. 11.x core/modules/inline_form_errors/src/RenderElementHelper.php \Drupal\inline_form_errors\RenderElementHelper::processElement()

Process all render elements.

Parameters

array $element: An associative array containing the properties and children of the element. Note that $element must be taken by reference here, so processed child elements are taken over into $form_state.

\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/modules/inline_form_errors/src/RenderElementHelper.php, line 40

Class

RenderElementHelper
Provides functionality to process render elements.

Namespace

Drupal\inline_form_errors

Code

public static function processElement(array &$element, FormStateInterface $form_state, array &$complete_form) {
    // Prevent displaying inline form errors when disabled for the whole form.
    if (!empty($complete_form['#disable_inline_form_errors'])) {
        $element['#error_no_message'] = TRUE;
    }
    return $element;
}

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