Giter Site home page Giter Site logo

Comments (5)

westonruter avatar westonruter commented on August 25, 2024

Likewise, when calling $snapshot->set( $setting_id, null ) this should have the effect of removing the setting from the snapshot.

from wp-customize-snapshots.

valendesigns avatar valendesigns commented on August 25, 2024

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.

westonruter avatar westonruter commented on August 25, 2024

@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.

valendesigns avatar valendesigns commented on August 25, 2024

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.

kienstra avatar kienstra commented on August 25, 2024

Pull Request Opened

Hi @westonruter,
Could you please review this pull request?

from wp-customize-snapshots.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.