WebDevStudios / WebDevStudios/custom-post-type-ui

Local JSON

Open
#891 26 comments 3 reactions 1 assignee View on GitHub

@tw2113 is already working on this.

Since Sep 15, 2022.

Dominant language
PHP
Stars
641
Forks
139
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.