﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	focuses	prnumber
37964	Allow customizer controls to be encapsulated by accepting pre-instantiated settings	westonruter	westonruter	"In #35926 the ability to add setting-less controls was made possible. The work here only went halfway, however. Consider wanting to re-use a control in a standalone context (see #29071), where the settings used in the control are just plain `wp.customize.Value` instances. Controls should allow pre-instantiated `Value` (`Setting`) objects to be passed in as `params.settings`. And when this is done, there would be no `api( settingId... )` deferrals.

So one should be able to create a new control like this:

{{{#!js
var control = new wp.customize.Control( 'product_name', {
    // ...
    settings: {
        'default': new wp.customize.Value( 'Something' )
    }
} );
}}}

Instead of having to do:

{{{#!js
wp.customize.create( 'product_name', 'product_name', 'Something', {} );
control = new wp.customize.Control( 'product_name', {
    // ...
    settings: {
        'default': 'product_name'
    }
} );
}}}

The goal is to allow controls to be encapsulated and to be able to use them in standalone contexts or embedded inside of other controls.

Related:
* #30738
* #37275
* #29071"	enhancement	closed	high	4.9	Customize	3.4	normal	fixed	has-patch needs-unit-tests has-dev-note		javascript	
