Skip to content

Commit ef496e2

Browse files
author
Igor Chepurnoy
committed
update position for js to POS_READY, update run function
1 parent c8cc5dc commit ef496e2

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

IonSlider.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,17 @@ class IonSlider extends InputWidget
3737
/**
3838
* Render range slider
3939
*
40-
* @return string|void
40+
* @return string
4141
*/
4242
public function run()
4343
{
44+
$this->registerAssets();
45+
4446
if ($this->hasModel()) {
45-
echo Html::activeTextInput($this->model, $this->attribute, $this->options);
46-
} else {
47-
echo Html::textInput($this->name, $this->value, $this->options);
47+
return Html::activeTextInput($this->model, $this->attribute, $this->options);
4848
}
4949

50-
$this->registerAssets();
50+
return Html::textInput($this->name, $this->value, $this->options);
5151
}
5252

5353
/**
@@ -57,16 +57,15 @@ protected function registerAssets()
5757
{
5858
$view = $this->getView();
5959
IonSliderAsset::register($view);
60-
$js = '$("#' . $this->options['id'] . '").ionRangeSlider(' . $this->getPluginOptions() . ');';
61-
$view->registerJs($js, $view::POS_END);
60+
$view->registerJs('$("#' . $this->options['id'] . '").ionRangeSlider(' . $this->getPluginOptions() . ');');
6261
}
6362

6463
/**
6564
* Return plugin options in json format
6665
*
6766
* @return string
6867
*/
69-
public function getPluginOptions()
68+
protected function getPluginOptions()
7069
{
7170
$this->pluginOptions['type'] = ArrayHelper::getValue($this->pluginOptions, 'type', $this->type);
7271

0 commit comments

Comments
 (0)