#36167 closed enhancement (fixed)
Improve alignment between settings params between Customizer Controls and Partials
Reported by: | westonruter | Owned by: | westonruter |
---|---|---|---|
Milestone: | 4.9 | Priority: | low |
Severity: | normal | Version: | 4.6 |
Component: | Customize | Keywords: | has-dev-note |
Focuses: | Cc: |
Description
In #27355, the concept of a Partial
was introduced and is analogous to a Control
in many ways, particularly in that it an object associated with one or more settings. A control is instantiated in JS like:
var control = new wp.customize.Control( 'foo', { params: { setting: 'default', settings: { 'default': 'foo', 'bar': 'bar' }, } });
Whereas a partial is instantiated like:
var control = new wp.customize.Partial( 'foo', { params: { settings: [ 'foo', 'bar' ], primarySetting: 'foo' } });
Note the difference in how a partial uses primarySetting
to designate the main setting for a control, whereas a control has a secondary “setting key” which is used identify which of the settings in the object passed should be the main setting.
Personally, the way settings
are passed to Controls is not very intuitive to me, but to improve the parity in the API, perhaps both styles should be accepted by the partial.
Attachments (1)
Change History (8)
Note: See
TracTickets for help on using
tickets.
This is specifically introduced in 4.5/trunk.
I think it could be nice to have parity here, but on the other hand with it not being in 4.5, not sure that it's worth changing later, particularly given the relative complexity of the patch. If anything, since the partial approach is clearer, we may want to update controls to accept that so that we're moving toward a clearer API.