Comments (5)
Likewise, when calling $snapshot->set( $setting_id, null )
this should have the effect of removing the setting from the snapshot.
from wp-customize-snapshots.
That isn't really needed in wp-admin. I envisioned creating a backbone collection of the setting IDs and using buttons to remove and undo. The buttons would modified the collection and dynamically update a hidden input. That way when "Save Draft" is clicked the new content is updated without those IDs.
from wp-customize-snapshots.
@valendesigns OK, so you're thinking to not do this the WP admin edit post screen, but rather inside the Customizer itself? I think this ties into that idea we had about providing a UI to list out what the current pending changes are in the Customizer. When loading the Customizer with a snapshot, we'd need to grab all of the setting values prior to calling preview
and then export them to JS; we likewise have the original setting values in wp.customize.settings.settings
. Then in the UI for showing the dirty settings, all that we'd need to do is have a button listed with each setting that says “revert” and the behavior would be to override the setting's value to be whatever the original/non-snapshotted value was, and then set _dirty
to false
.
The trick then would be if the user updates the snapshot, we'd also need to send a list of all of the settings that have been reverted so that when the snapshot is saved, those settings can be removed from it. This was what I was referring to with null
. If reverted settings persist in the settings that are sent to the server when updating the snapshot, but instead of being the actual (when they are dirty) value we send null
instead, this can be a way to indicate that the setting should be dropped from the snapshot.
from wp-customize-snapshots.
No, I think you misunderstood me, we're talking about two different pieces of the puzzle. I'm saying that we don't need to bootstrap the Customizer in wp-admin
and use the CustomizeSnapshots::set()
method to remove settings by supplying a null
value. Instead we filter the post_content
during save to unset the IDs we want removed.
What you mentioned above still is valid if we want to revert settings in the Customizer, but that is low priority IMO.
from wp-customize-snapshots.
Pull Request Opened
Hi @westonruter,
Could you please review this pull request?
- 73c5b28 : Create link
'Remove setting'
, which toggles to'Restore setting'
on click.
It also sets a hidden input field for each setting to be removed.
On saving, these appear in$_REQUEST[ 'customize_snapshot_remove_settings' ]
.
Filter post content on content_save_pre when this is saved.
If$_REQUEST
has settings to be removed, filter them out.
Also, add simple styling of this 'Remove setting' link.
It appears red when it has the text "Remove setting, and blue otherwise.
from wp-customize-snapshots.
Related Issues (20)
- Remember the preview URL and expanded panel/section when saving a changeset HOT 3
- Unauthorized users can't preview the snapshots HOT 8
- Date fields display with error message when selecting non-schedule status HOT 1
- Typo in dockblock
- Migrate to changesets notice also shows when somebody has directly installed WordPress > 4.7
- Publish button not enabled on theme switch
- Check nav menu post reference before garbage collect HOT 2
- Sharing changeset preview will 404 if static front page is not set HOT 3
- Add list of most recent changeset under Customize on frontend
- Export changeset to file HOT 7
- Let changeset title default to the labels of the settings modified or controls that were interacted with
- Change link text for post list table action from “Edit” to “Inspect”
- Add minimum PHP version to readme
- Cannot Enter Title on Edit Changeset page for Published Changeset HOT 5
- Mobile users can't access Customize in the Admin Bar HOT 1
- Changesets cannot be "duplicated" because UUIDs are, of course, unique HOT 2
- Clicking pending status freezes the browser when user does not have publish capability. HOT 4
- Save outer_section state for 4.9+
- Undefined Index displaying Snapshot Details HOT 1
- Revisions after publish HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-customize-snapshots.