You are here

function webform_bootstrap_preprocess_form_element in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_bootstrap/webform_bootstrap.module \webform_bootstrap_preprocess_form_element()

Implements hook_preprocess_form_element() for form element templates.

File

modules/webform_bootstrap/webform_bootstrap.module, line 142
Helps support Webform to Bootstrap integration.

Code

function webform_bootstrap_preprocess_form_element(&$variables) {
  if (!_webform_bootstrap_is_active_theme()) {
    return;
  }
  if (!WebformElementHelper::isWebformElement($variables['element'])) {
    return;
  }

  // Do not display phone number using inline form.
  // @see https://www.drupal.org/project/webform/issues/2910776s
  // @see https://www.drupal.org/project/bootstrap/issues/2829634
  if (WebformElementHelper::isType($variables['element'], 'tel') && isset($variables['attributes']['class'])) {
    WebformArrayHelper::removeValue($variables['attributes']['class'], 'form-inline');
  }
}