You are here

public function WebformAjaxElementTrait::buildAjaxElementTrigger in Webform 6.x

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

Build an Ajax element's trigger.

Parameters

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

array &$element: The element to trigger the Ajax update.

5 calls to WebformAjaxElementTrait::buildAjaxElementTrigger()
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::buildAjaxElementTriggerRecursive in src/Plugin/WebformElement/WebformEntityReferenceTrait.php
Build an ajax elements trigger.
WebformEntityReferenceTrait::form in src/Plugin/WebformElement/WebformEntityReferenceTrait.php
WebformEntityReferenceWidgetTrait::formElement in src/Plugin/Field/FieldWidget/WebformEntityReferenceWidgetTrait.php

File

src/Element/WebformAjaxElementTrait.php, line 102

Class

WebformAjaxElementTrait
Trait for ajax element support.

Namespace

Drupal\webform\Element

Code

public function buildAjaxElementTrigger($id, array &$element) {
  $element['#attributes']['data-webform-trigger-submit'] = '.' . $this
    ->getAjaxElementUpdateClass($id);
  $element['#webform_ajax_element_type'] = 'trigger';
  $element['#webform_ajax_element_id'] = $id;
}