Commit bc743a32 by Qiang Xue

Fixes #968: clientOptions should not be ignored when enabling internationalization.

parent 2ae5c23d
......@@ -9,6 +9,7 @@ namespace yii\jui;
use Yii;
use yii\helpers\Html;
use yii\helpers\Json;
/**
* DatePicker renders an datepicker jQuery UI widget.
......@@ -61,11 +62,19 @@ class DatePicker extends InputWidget
public function run()
{
echo $this->renderWidget() . "\n";
$this->registerWidget('datepicker', DatePickerAsset::className());
if ($this->language !== false) {
$view = $this->getView();
DatePickerRegionalAsset::register($view);
$view->registerJs("$('#{$this->options['id']}').datepicker('option', $.datepicker.regional['{$this->language}']);");
// do not pass in any options when creating the widget
// set the options later so that the options can be combined with regional options
$options = $this->clientOptions;
$this->clientOptions = array();
$this->registerWidget('datepicker', DatePickerAsset::className());
$this->clientOptions = $options;
$options = Json::encode($options);
$view->registerJs("$('#{$this->options['id']}').datepicker('option', $.extend({}, $.datepicker.regional['{$this->language}'], $options));");
} else {
$this->registerWidget('datepicker', DatePickerAsset::className());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment