Version: current

     1 <?php
     2
     3 class MyRangeField extends RangeField {
     4     protected $minValue = null;
     5     protected $maxValue = null;
     6
     7     function __construct($name, $title = null, $value = "", $MinMaxValue = false, $className = 'NumericField'){
     8         $this->minField = new $className($name . '[min]', false);
     9         $this->maxField = new $className($name . '[max]', false);
    10
    11         if ($MinMaxValue) {
    12             $this->minValue = $MinMaxValue['min'];
    13             $this->maxValue = $MinMaxValue['max'];
    14         }
    15
    16         parent::__construct($name, $title, $value);
    17     }
    18
    19     function Field() {
    20         return '<label class="min" minValue="' . $this->minValue . '">' . _t('RangeField.FROM', 'from') . $this->minField->Field() . '</label> <label class="max" maxValue="' . $this->maxValue . '">' . _t('RangeField.TO', 'to') . $this->maxField->Field() . '</label>';
    21     }
    22 }

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -