function public static function ProcessManager::processAjax

8.x-3.x ProcessManager.php public static ProcessManager::processAjax(Element $element, FormStateInterface $form_state, array &$complete_form)

Processes elements with AJAX properties.

Parameters

\Drupal\bootstrap\Utility\Element $element: The element object.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

array $complete_form: The complete form structure.

Class

ProcessManager
Manages discovery and instantiation of Bootstrap form process callbacks.

Namespace

Drupal\bootstrap\Plugin

Source src/Plugin/ProcessManager.php (line 125)

public static function processAjax(Element $element, FormStateInterface $form_state, array &$complete_form) {
  $ajax = $element->getProperty('ajax');

  // Show throbber AJAX requests in an input button group.
  $ignore_types = ['checkbox', 'checkboxes', 'hidden', 'radio', 'radios'];
  if ((!isset($ajax['progress']['type']) || $ajax['progress']['type'] === 'throbber') && !$element->isType($ignore_types)) {
    // Use an icon for autocomplete "throbber".
    $icon = Bootstrap::glyphicon('refresh');
    $element->appendProperty('field_suffix', Element::create($icon)->addClass(['ajax-progress', 'ajax-progress-throbber']));
    $element->setProperty('input_group', TRUE);
  }
}