|
|
@ -15,7 +15,7 @@ use yii\helpers\Html; |
|
|
|
* For example, |
|
|
|
* For example, |
|
|
|
* |
|
|
|
* |
|
|
|
* ``` |
|
|
|
* ``` |
|
|
|
* echo Slider::widget([ |
|
|
|
* echo SliderInput::widget([ |
|
|
|
* 'model' => $model, |
|
|
|
* 'model' => $model, |
|
|
|
* 'attribute' => 'amount', |
|
|
|
* 'attribute' => 'amount', |
|
|
|
* 'clientOptions' => [ |
|
|
|
* 'clientOptions' => [ |
|
|
@ -28,7 +28,7 @@ use yii\helpers\Html; |
|
|
|
* The following example will use the name property instead: |
|
|
|
* The following example will use the name property instead: |
|
|
|
* |
|
|
|
* |
|
|
|
* ``` |
|
|
|
* ``` |
|
|
|
* echo Slider::widget([ |
|
|
|
* echo SliderInput::widget([ |
|
|
|
* 'name' => 'amount', |
|
|
|
* 'name' => 'amount', |
|
|
|
* 'clientOptions' => [ |
|
|
|
* 'clientOptions' => [ |
|
|
|
* 'min' => 1, |
|
|
|
* 'min' => 1, |
|
|
@ -75,8 +75,10 @@ class SliderInput extends InputWidget |
|
|
|
|
|
|
|
|
|
|
|
if ($this->hasModel()) { |
|
|
|
if ($this->hasModel()) { |
|
|
|
echo Html::activeHiddenInput($this->model, $this->attribute, $this->options); |
|
|
|
echo Html::activeHiddenInput($this->model, $this->attribute, $this->options); |
|
|
|
|
|
|
|
$this->clientOptions['value'] = $this->model{$this->attribute}; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
echo Html::hiddenInput($this->name, $this->value, $this->options); |
|
|
|
echo Html::hiddenInput($this->name, $this->value, $this->options); |
|
|
|
|
|
|
|
$this->clientOptions['value'] = $this->value; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!isset($this->clientEvents['slide'])) { |
|
|
|
if (!isset($this->clientEvents['slide'])) { |
|
|
@ -86,6 +88,5 @@ class SliderInput extends InputWidget |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->registerWidget('slider', SliderAsset::className(), $this->containerOptions['id']); |
|
|
|
$this->registerWidget('slider', SliderAsset::className(), $this->containerOptions['id']); |
|
|
|
$this->getView()->registerJs('$("#' . $this->options['id'] . '").val($("#' . $this->id . '").slider("value"));'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|