From 97c598574874f44f437add160ebad8b76c47d074 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sun, 15 Oct 2017 22:42:00 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/customize-controls.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index 04bf29c218..0b71a742b3 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -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,