You are here

public static function RangeSlider::processRangeSlider in Range Slider 8

Processes a rangeslider form element.

File

src/Element/RangeSlider.php, line 64

Class

RangeSlider
Provides a slider for input of a number within a specific range.

Namespace

Drupal\range_slider\Element

Code

public static function processRangeSlider(&$element, FormStateInterface $form_state, &$complete_form) {
  if (isset($element['#output']) && in_array($element['#output'], self::getOutputTypes())) {
    $element['#attached']['drupalSettings']['range_slider']['elements']['#' . $element['#id']]['output'] = $element['#output'];
  }
  if (isset($element['#output__field_prefix'])) {
    $element['#attached']['drupalSettings']['range_slider']['elements']['#' . $element['#id']]['prefix'] = $element['#output__field_prefix'];
  }
  if (isset($element['#output__field_suffix'])) {
    $element['#attached']['drupalSettings']['range_slider']['elements']['#' . $element['#id']]['suffix'] = $element['#output__field_suffix'];
  }
  $element['#attached']['library'][] = 'range_slider/element.rangeslider';
  return $element;
}