Customize: Add `'save-request-params'` event on `wp.customize` for plugins to inject/modify params in `save` requests.

Allows feature plugins, for example, to supply a `customize_changeset_title` param instead of having to wrap `wp.customize.previewer.query`.

Props dlh.
Fixes #42206.


git-svn-id: https://develop.svn.wordpress.org/trunk@41869 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-10-15 22:42:00 +00:00
parent 0e8b17dd64
commit 97c5985748
1 changed files with 6 additions and 0 deletions

View File

@ -589,6 +589,9 @@
data.customize_changeset_autosave = 'true';
}
// Allow plugins to modify the params included with the save request.
api.trigger( 'save-request-params', data );
request = wp.ajax.post( 'customize_save', data );
request.done( function requestChangesetUpdateDone( data ) {
@ -7180,6 +7183,9 @@
query.customize_changeset_title = args.title;
}
// Allow plugins to modify the params included with the save request.
api.trigger( 'save-request-params', query );
/*
* Note that the dirty customized values will have already been set in the
* changeset and so technically query.customized could be deleted. However,