You are here

public static function ProcessManager::processAjax in Express 8

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.

1 call to ProcessManager::processAjax()
ProcessManager::process in themes/contrib/bootstrap/src/Plugin/ProcessManager.php
Global #process callback for form elements.

File

themes/contrib/bootstrap/src/Plugin/ProcessManager.php, line 91
Contains \Drupal\bootstrap\Plugin\ProcessManager.

Class

ProcessManager
Manages discovery and instantiation of Bootstrap form process callbacks.

Namespace

Drupal\bootstrap\Plugin

Code

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.
  if (!$element
    ->isType('hidden') && (!isset($ajax['progress']['type']) || $ajax['progress']['type'] === 'throbber')) {

    // 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);
  }
}