You are here

public static function ProcessManager::process in Express 8

Global #process callback for form elements.

Parameters

array $element: The element render array.

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

array $complete_form: The complete form structure.

Return value

array The altered element array.

See also

\Drupal\bootstrap\Plugin\Alter\ElementInfo::alter

File

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

Class

ProcessManager
Manages discovery and instantiation of Bootstrap form process callbacks.

Namespace

Drupal\bootstrap\Plugin

Code

public static function process(array $element, FormStateInterface $form_state, array &$complete_form) {
  if (!empty($element['#bootstrap_ignore_process'])) {
    return $element;
  }
  static $theme;
  if (!isset($theme)) {
    $theme = Bootstrap::getTheme();
  }
  $e = Element::create($element, $form_state);

  // Process AJAX.
  if ($e
    ->getProperty('ajax') && !$e
    ->isButton() || $e
    ->getProperty('autocomplete_route_name')) {
    static::processAjax($e, $form_state, $complete_form);
  }

  // Add "form-inline" class.
  if ($e
    ->hasClass('container-inline')) {
    $e
      ->replaceClass('container-inline', 'form-inline');
  }
  if ($e
    ->isType([
    'color',
    'date',
    'number',
    'range',
    'tel',
    'weight',
  ])) {
    $e
      ->addClass('form-inline', 'wrapper_attributes');
  }

  // Process input groups.
  if ($e
    ->getProperty('input') && ($e
    ->getProperty('input_group') || $e
    ->getProperty('input_group_button'))) {
    static::processInputGroups($e, $form_state, $complete_form);
  }
  return $element;
}