You are here

public static function WeightSelectorWidget::rangeOptions in Weight 8.3

Get weight range options.

2 calls to WeightSelectorWidget::rangeOptions()
WeightSelector::viewsForm in src/Plugin/views/field/WeightSelector.php
WeightSelectorWidget::formElement in src/Plugin/Field/FieldWidget/WeightSelectorWidget.php
Returns the form for a single field widget.

File

src/Plugin/Field/FieldWidget/WeightSelectorWidget.php, line 41

Class

WeightSelectorWidget
Plugin implementation of the 'weight selector' widget.

Namespace

Drupal\weight\Plugin\Field\FieldWidget

Code

public static function rangeOptions($range) {
  $options = [];
  for ($i = -$range; $i <= $range; $i++) {
    $options[$i] = $i;
  }
  return $options;
}