You are here

public static function EntityReferenceItem::fieldSettingsAjaxProcessElement in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::fieldSettingsAjaxProcessElement()
  2. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php \Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem::fieldSettingsAjaxProcessElement()

Adds entity_reference specific properties to AJAX form elements from the field settings form.

See also

static::fieldSettingsAjaxProcess()

1 call to EntityReferenceItem::fieldSettingsAjaxProcessElement()
EntityReferenceItem::fieldSettingsAjaxProcess in core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php
Render API callback: Processes the field settings form.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php, line 655

Class

EntityReferenceItem
Defines the 'entity_reference' entity field type.

Namespace

Drupal\Core\Field\Plugin\Field\FieldType

Code

public static function fieldSettingsAjaxProcessElement(&$element, $main_form) {
  if (!empty($element['#ajax'])) {
    $element['#ajax'] = [
      'callback' => [
        static::class,
        'settingsAjax',
      ],
      'wrapper' => $main_form['#id'],
      'element' => $main_form['#array_parents'],
    ];
  }
  foreach (Element::children($element) as $key) {
    static::fieldSettingsAjaxProcessElement($element[$key], $main_form);
  }
}