You are here

protected function Range::rangeElement in GridStack 8.2

Returns the range element.

1 call to Range::rangeElement()
Form::styleForm in src/Plugin/gridstack/stylizer/Form.php

File

src/Plugin/gridstack/stylizer/Range.php, line 20

Class

Range
Provides the range styles.

Namespace

Drupal\gridstack\Plugin\gridstack\stylizer

Code

protected function rangeElement(array $settings) {
  $element = [];
  foreach (GridStackDefault::rangeElements() as $key) {
    $default = 1;
    $min = 0;
    $max = 1;
    $step = 0.05;
    if (strpos($key, 'height') !== FALSE) {
      $default = 0;
      $min = 0;
      $max = 6000;
      $step = 1;
    }
    $value = empty($settings[$key]) ? $default : $settings[$key];
    $element[$key] = $this
      ->styleElement($key, $value, $settings);
    $element[$key]['#min'] = $min;
    $element[$key]['#max'] = $max;
    $element[$key]['#step'] = $step;
    $element[$key]['#field_prefix'] = $value;
  }
  return $element;
}