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.

Built from https://develop.svn.wordpress.org/trunk@41869


git-svn-id: http://core.svn.wordpress.org/trunk@41703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-10-15 22:42:48 +00:00
parent 12f647679b
commit 2e184426c0
3 changed files with 11 additions and 5 deletions

View File

@ -589,6 +589,9 @@
data.customize_changeset_autosave = 'true'; 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 = wp.ajax.post( 'customize_save', data );
request.done( function requestChangesetUpdateDone( data ) { request.done( function requestChangesetUpdateDone( data ) {
@ -7180,6 +7183,9 @@
query.customize_changeset_title = args.title; 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 * Note that the dirty customized values will have already been set in the
* changeset and so technically query.customized could be deleted. However, * changeset and so technically query.customized could be deleted. However,

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta2-41868'; $wp_version = '4.9-beta2-41869';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.