function FieldConfigEditForm::addAjaxCallbacks

Same name in other branches
  1. 10 core/modules/field_ui/src/Form/FieldConfigEditForm.php \Drupal\field_ui\Form\FieldConfigEditForm::addAjaxCallbacks()

Add Ajax callback for all inputs.

Parameters

array $form: An associative array containing the structure of the form.

1 call to FieldConfigEditForm::addAjaxCallbacks()
FieldConfigEditForm::form in core/modules/field_ui/src/Form/FieldConfigEditForm.php
Gets the actual form array to be built.

File

core/modules/field_ui/src/Form/FieldConfigEditForm.php, line 495

Class

FieldConfigEditForm
Provides a form for the field settings form.

Namespace

Drupal\field_ui\Form

Code

private function addAjaxCallbacks(array &$form) : void {
    if (isset($form['#type']) && !isset($form['#ajax'])) {
        if ($this->elementInfo
            ->getInfoProperty($form['#type'], '#input') && !$this->elementInfo
            ->getInfoProperty($form['#type'], '#is_button')) {
            $form['#ajax'] = [
                'trigger_as' => [
                    'name' => 'field_storage_submit',
                ],
                'wrapper' => 'field-combined',
                'event' => 'change',
            ];
        }
    }
    foreach (Element::children($form) as $child_key) {
        $this->addAjaxCallbacks($form[$child_key]);
    }
}

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