Commit a1e6c16e by Carsten Brandt

Merge branch 'master' of github.com:yiisoft/yii2

* 'master' of github.com:yiisoft/yii2: Fixes #968: clientOptions should not be ignored when enabling internationalization. minor doc fix.
parents 3a981e26 bc743a32
...@@ -175,7 +175,9 @@ $customer->delete(); ...@@ -175,7 +175,9 @@ $customer->delete();
Customer::updateAllCounters(array('age' => 1)); Customer::updateAllCounters(array('age' => 1));
``` ```
Notice that you can always use the `save` method, and ActiveRecord will automatically perform an INSERT for new records and an UPDATE for existing ones. > Info: The `save()` method will either perform an `INSERT` or `UPDATE` SQL statement, depending
on whether the ActiveRecord being saved is new or not by checking `ActiveRecord::isNewRecord`.
Data Input and Validation Data Input and Validation
------------------------- -------------------------
......
...@@ -38,7 +38,7 @@ Compares the specified attribute value with another value and validates if they ...@@ -38,7 +38,7 @@ Compares the specified attribute value with another value and validates if they
Verifies if the attribute represents a date, time or datetime in a proper format. Verifies if the attribute represents a date, time or datetime in a proper format.
- `format` the date format that the value being validated should follow accodring to [[http://www.php.net/manual/en/datetime.createfromformat.php]]. _('Y-m-d')_ - `format` the date format that the value being validated should follow according to [[http://www.php.net/manual/en/datetime.createfromformat.php]]. _('Y-m-d')_
- `timestampAttribute` the name of the attribute to receive the parsing result. - `timestampAttribute` the name of the attribute to receive the parsing result.
### `default`: [[DefaultValueValidator]] ### `default`: [[DefaultValueValidator]]
......
...@@ -9,6 +9,7 @@ namespace yii\jui; ...@@ -9,6 +9,7 @@ namespace yii\jui;
use Yii; use Yii;
use yii\helpers\Html; use yii\helpers\Html;
use yii\helpers\Json;
/** /**
* DatePicker renders an datepicker jQuery UI widget. * DatePicker renders an datepicker jQuery UI widget.
...@@ -61,11 +62,19 @@ class DatePicker extends InputWidget ...@@ -61,11 +62,19 @@ class DatePicker extends InputWidget
public function run() public function run()
{ {
echo $this->renderWidget() . "\n"; echo $this->renderWidget() . "\n";
$this->registerWidget('datepicker', DatePickerAsset::className());
if ($this->language !== false) { if ($this->language !== false) {
$view = $this->getView(); $view = $this->getView();
DatePickerRegionalAsset::register($view); 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