[wp-trac] [WordPress Trac] #30937: Add Customizer transactions

WordPress Trac noreply at wordpress.org
Sun Aug 7 18:46:55 UTC 2016


#30937: Add Customizer transactions
-----------------------------+-----------------------------
 Reporter:  westonruter      |       Owner:  westonruter
     Type:  feature request  |      Status:  assigned
 Priority:  high             |   Milestone:  Future Release
Component:  Customize        |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  needs-patch      |     Focuses:
-----------------------------+-----------------------------
Changes (by westonruter):

 * focuses:  javascript =>


Comment:

 @MikeSchinkel @Fab1en right, it's not really a JavaScript focus. I've
 removed it.

 Transactions here make use of the architecture in Customizer's settings
 (`WP_Customize_Setting`) to model data in WordPress and provide the
 interface abstraction for getting the `value()`, doing logic to
 `sanitize()`/`validate()` a value, applying filters to `preview` changes,
 and lastly the logic for persisting the `update` into the database.

 The [https://github.com/xwp/wp-customize-snapshots Customize Snapshots]
 plugin implements most of the key concepts on top of the existing
 Customizer in core. It introduces a `customize_snapshot` post type which
 has its `post_content` consisting of a JSON blob containing the current
 Customizer state (the dirty settings). Creating these snapshot post types
 does not depend on the Customizer UI at all. The can be created via WP-CLI
 or via the REST API. The Snapshots plugin has [https://github.com/xwp/wp-
 customize-snapshots/pull/63 initial read support] for listing out
 snapshots and inspecting their contents. The next step for REST API
 integration would be allowing [https://github.com/xwp/wp-customize-
 snapshots/issues/64 updates to these snapshots].

 Snapshots/transactions can be used completely independently of the
 Customizer UI. In fact, the Snapshots plugin includes a link in the
 Customizer UI to load up the frontend of the site with the snapshot UUID
 added for previewing outside of the Customizer, even if not logged in. If
 you have a snapshot UUID, you can add it to any request to WP, including
 REST API calls, to get a response back with the Customizer state
 associated with that UUID applied.

 The REST API interface for manipulating snapshots/transactions would allow
 for completely alternative UIs for the Customizer. For example, a mobile
 app could start a new editing session which then writes changes into a
 snapshot/transaction. When in this session, the user could go into a
 preview mode which could then supply the snapshot UUID in all of its REST
 API requests, allowing the user to see how the app would behave once the
 changes in the snapshot/transaction/changeset are “committed”.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30937#comment:49>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list