WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#35617 closed enhancement (fixed)

Export more Customizer app settings in preview

Reported by: westonruter Owned by: westonruter
Milestone: 4.5 Priority: normal
Severity: normal Version: 3.4
Component: Customize Keywords: has-patch
Focuses: javascript Cc:
PR Number:

Description

As more logic is added to the Customizer preview (e.g. selective refresh and inline controls), more of the Customizer's app settings need to be available.

  • Preview nonce.
  • Other nonces added via customize_refresh_nonces.
  • Current theme (stylesheet and whether active).
  • The previewed URL.

Some of these are currently being exported to JS with each refresh via the WP_Customize_Nav_Menus::export_preview_data(), and should be moved to the core app settings exported to wp.customize.settings.

Additionally, the nonce settings should be refreshed whenever a nonce-refresh happens in the pane.

Attachments (3)

35617.0.diff (3.1 KB) - added by westonruter 4 years ago.
35617.1.diff (5.0 KB) - added by westonruter 4 years ago.
Re-use theme and nonce from wp.customize.settings for nav menus
35617.2.diff (10.6 KB) - added by westonruter 4 years ago.

Download all attachments as: .zip

Change History (7)

#1 @westonruter
4 years ago

  • Keywords has-patch added
  • Owner set to westonruter
  • Status changed from new to accepted

In 35617.0.diff:

  • Send nonces to preview upon nonce-refresh.
  • Generate nonces with each preview refresh.
  • Include all nonces added via customize_refresh_nonces with the exported data.

This patch builds upon the patch in #35616.

Note that with the nonces exported here, nav menus in the Customizer will be able to remove its separate exporting of the data.

@westonruter
4 years ago

@westonruter
4 years ago

Re-use theme and nonce from wp.customize.settings for nav menus

@westonruter
4 years ago

#2 @westonruter
4 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 36414:

Customizer: Export nonce, theme, and url app settings in preview as exported in pane.

  • Introduce WP_Customize_Manager::get_nonces() to consolidate logic for retrieving nonces.
  • Export nonces centrally in wp.customize.settings.nonce with each request and update nav menus preview to utilize.
  • Send updated nonces to preview upon nonce-refresh.
  • Request full preview refresh if Nav Menu selective refresh request fails (e.g. due to bad nonce).
  • Update nav menus and widgets in Customizer to utilize customize_refresh_nonces for exporting nonces and keeping them up to date.

See #27355.
Fixes #35617.

#3 @westonruter
4 years ago

In 36432:

Customizer: Fix searching for available nav menu items by updating reference to nonce.

Fixes regression introduced in [36414] where the nonce for listing available nav menu items was updated to use the new centralized location at wp.customize.settings.nonce, but the nonce for search did not get updated.

See #35617.

#4 @DrewAPicture
4 years ago

In 36835:

Docs: Improve documentation for WP_Customize_Nav_Menus::filter_nonces(), introduced in [36414].

See #27355, #35617. See #35986.

Note: See TracTickets for help on using tickets.