You are here

protected function YamlFormEntityReferenceTrait::updateAjaxCallbackRecursive in YAML Form 8

Replace #ajax = TRUE with a work #ajax callback.

Parameters

array $element: A element.

array $ajax_settings: A #ajax callback.

1 call to YamlFormEntityReferenceTrait::updateAjaxCallbackRecursive()
YamlFormEntityReferenceTrait::form in src/Plugin/YamlFormElement/YamlFormEntityReferenceTrait.php

File

src/Plugin/YamlFormElement/YamlFormEntityReferenceTrait.php, line 539

Class

YamlFormEntityReferenceTrait
Provides an 'entity_reference' trait.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

protected function updateAjaxCallbackRecursive(array &$element, array $ajax_settings) {
  foreach (Element::children($element) as $key) {
    $element[$key]['#access'] = TRUE;
    if (isset($element[$key]['#ajax']) && $element[$key]['#ajax'] === TRUE) {
      $element[$key]['#ajax'] = $ajax_settings;
    }
    $this
      ->updateAjaxCallbackRecursive($element[$key], $ajax_settings);
  }
}