Skip to content

Local JSON #891

Description

@tw2113

We will be borrowing a lot from the pros, I mean, Advanced Custom Fields. Do we dare outright copy https://plugins.trac.wordpress.org/browser/advanced-custom-fields/tags/5.12.3/includes/local-json.php and amend as needed?

Enabling

  • UI setting vs folder existence
    • We don't really have a page with random-ish settings available, so enabling dynamically would be awesome and save time/options pages.
  • "is enabled" method, which checks if folder exists and if yes return true. else return false.
    • return false if not write-able to.
      • Throw an admin notice of some sort if so.

Saving in UI

  • New items should be added to file.
  • Existing items should update update to file.
  • Deleted items should be removed from file.

Avoiding file deletion.

  • With ACF, you have to version control the file, and do a git reset to restore after clearing out database version. How can we avoid this nuisance step?
    • Tools menu and {""} import method doesn't trigger saving/deleting hooks, but still removes database options.

Loading and precedence

  • DB option should be used before local JSON copy.

Sync settings

  • Show if local version is different or more specifically newer?
  • Timestamps like Advanced Custom Fields?
    • New CPTUI option for last save time?
      • Prevents need to edit our existing data.
      • Only if we enable local JSON version?
  • UI needed to sync.
    • Link in "Listings" page?

CPTUI UI data display like tools, get code, listings.

  • Should we show local loaded data in the same places, perhaps with notes of "loaded via theme" or similar wording?
    • Show but have various links like "edit" etc disabled because there's nothing in the UI to edit without sync?

Multi-Site

  • append ID to file name, if Multi-Site and not main site. Leave main site ID off to avoid potential backwards compatibility breaking for people using the functionality already.

Extra testing

Confirm this does not interfere with CPTUI-Extended. Bonus points if made to work with Network-wide content types, or made to be able to work with that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions