You are here

public function WebformAjaxElementTrait::buildAjaxElementWrapper in Webform 6.x

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

Build an Ajax element's wrapper.

Parameters

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

array &$element: The element to be update via Ajax.

4 calls to WebformAjaxElementTrait::buildAjaxElementWrapper()
EmailWebformHandler::buildElement in src/Plugin/WebformHandler/EmailWebformHandler.php
Build A select other element for email address and names.
WebformAjaxElementTrait::buildAjaxElement in src/Element/WebformAjaxElementTrait.php
Build an Ajax element.
WebformEntityReferenceTrait::form in src/Plugin/WebformElement/WebformEntityReferenceTrait.php
WebformEntityReferenceWidgetTrait::formElement in src/Plugin/Field/FieldWidget/WebformEntityReferenceWidgetTrait.php

File

src/Element/WebformAjaxElementTrait.php, line 86

Class

WebformAjaxElementTrait
Trait for ajax element support.

Namespace

Drupal\webform\Element

Code

public function buildAjaxElementWrapper($id, array &$element) {
  $element['#prefix'] = '<div id="' . $this
    ->getAjaxElementWrapperId($id) . '">';
  $element['#suffix'] = '</div>';
  $element['#attached']['library'][] = 'webform/webform.element.ajax';
  $element['#webform_ajax_element_type'] = 'wrapper';
  $element['#webform_ajax_element_id'] = $id;
}