Customize: Allow controls to be created with pre-instantiated Setting object(s), or even with plain Value object(s).

* Allow passing settings in keyed object (e.g. `settings: { default: 'id' }  ), or as an array (e.g. `settings: [ 'id' ]`) with first being default; again, `Setting`/`Value` objects may be supplied instead of IDs.
* Allow a single setting to be supplied with just a single `setting` param, either a string or a `Setting`/`Value` object.
* Update `changeset_status` and `scheduled_changeset_date` to be added dynamically with JS and simply passing of `api.state()` instances as `setting`.
* Introduce a `data-customize-setting-key-link` attribute which, unlike `data-customize-setting-link`, allows passing the setting key (e.g. `default`) as opposed to the setting ID.
* Allow `WP_Customize_Control::get_link()` to return `data-customize-setting-key-link` when setting is not registered.
* Eliminate `default_value` from `WP_Customize_Date_Time_Control` since now comes from supplied `Value`.
* Export status choices as `wp.customize.settings.changeset.statusChoices`.
* Export date and time formats as `wp.customize.settings.dateFormat` and `wp.customize.settings.timeFormat` respectively.

Props westonruter, sayedwp.
See #39896, #30738, #30741, #42083.
Fixes #37964, #36167.


git-svn-id: https://develop.svn.wordpress.org/trunk@41750 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
westonruter
2017-10-04 20:01:12 +00:00
parent 11ccab09e0
commit 0cc238c7c7
8 changed files with 270 additions and 211 deletions
+4 -4
View File
@@ -138,7 +138,7 @@ body.trashing #publish-settings {
margin-bottom: 15px;
}
#customize-control-changeset_status label,
#customize-control-changeset_status .customize-inside-control-row,
#customize-control-changeset_preview_link input {
background-color: #ffffff;
border-bottom: 1px solid #ddd;
@@ -170,13 +170,13 @@ body.trashing #publish-settings {
border-color: #dc3232;
}
#customize-control-changeset_status label {
#customize-control-changeset_status .customize-inside-control-row {
padding-top: 10px;
padding-bottom: 10px;
font-weight: 500;
}
#customize-control-changeset_status label:first-of-type {
#customize-control-changeset_status .customize-inside-control-row:first-of-type {
border-top: 1px solid #ddd;
}
@@ -2809,7 +2809,7 @@ body.adding-widget .add-new-widget:before,
height: 31px;
}
#customize-control-changeset_status label {
#customize-control-changeset_status .customize-inside-control-row {
padding-top: 15px;
}