Skip to content

Commit

Permalink
Merge pull request #18 from xwp/bugfix/default-instance
Browse files Browse the repository at this point in the history
Ensure default instance value is used as base to merge new setting values
  • Loading branch information
westonruter committed Dec 20, 2016
2 parents e5da2d5 + 444f5ff commit ea2014f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/customize-widget-control-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ wp.customize.Widgets.Form = (function( api ) {
{
control: null,
config: {
l10n: {}
l10n: {},
default_instance: {}
}
},
properties
Expand All @@ -41,7 +42,7 @@ wp.customize.Widgets.Form = (function( api ) {
previousValidate = form.setting.validate;
form.setting.validate = function validate( value ) {
var setting = this, newValue, oldValue; // eslint-disable-line consistent-this
newValue = _.extend( {}, value );
newValue = _.extend( {}, form.config.default_instance, value );
oldValue = _.extend( {}, setting() );

newValue = previousValidate.call( setting, newValue );
Expand Down

0 comments on commit ea2014f

Please sign in to comment.