You are here

public static function BlockFieldItem::fieldSettingsAjaxProcessElement in Block field 8

Adds block_field specific properties to AJAX form elements from settings.

See also

\Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem

static::fieldSettingsAjaxProcess()

1 call to BlockFieldItem::fieldSettingsAjaxProcessElement()
BlockFieldItem::fieldSettingsAjaxProcess in src/Plugin/Field/FieldType/BlockFieldItem.php
Render API callback.

File

src/Plugin/Field/FieldType/BlockFieldItem.php, line 215

Class

BlockFieldItem
Plugin implementation of the 'block_field' field type.

Namespace

Drupal\block_field\Plugin\Field\FieldType

Code

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