You are here

protected static function WebformAjaxElementTrait::getAjaxElementWrapperRecursive in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Element/WebformAjaxElementTrait.php \Drupal\webform\Element\WebformAjaxElementTrait::getAjaxElementWrapperRecursive()

Get ajax element wrapper.

Parameters

string $id: The id used to create the Ajax wrapper and trigger.

array $element: An element or form containing the Ajax wrapper.

Return value

array|null The Ajax wrapper element.

1 call to WebformAjaxElementTrait::getAjaxElementWrapperRecursive()
WebformAjaxElementTrait::updateAjaxElementCallback in src/Element/WebformAjaxElementTrait.php
Ajax element update callback.

File

src/Element/WebformAjaxElementTrait.php, line 216

Class

WebformAjaxElementTrait
Trait for ajax element support.

Namespace

Drupal\webform\Element

Code

protected static function getAjaxElementWrapperRecursive($id, array $element) {
  if (isset($element['#webform_ajax_element_id']) && $element['#webform_ajax_element_id'] === $id && $element['#webform_ajax_element_type'] === 'wrapper') {
    return $element;
  }
  foreach (Element::children($element) as $key) {
    $ajax_element = static::getAjaxElementWrapperRecursive($id, $element[$key]);
    if ($ajax_element) {
      return $ajax_element;
    }
  }
  return NULL;
}