-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FSE: Fall back to next best template in hierarchy when querying through REST API #37258
Closed
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7d9f20e
Don't create template upon clicking Add New
ockham 175e327
Have controller's get_item() fall back to next best template in hiera…
ockham 1d447f8
Revert "Have controller's get_item() fall back to next best template …
ockham c59e70b
Make gutenberg_get_block_template fall back to use the template hiera…
ockham 5458b94
Compute theme name
ockham 94b23b3
Correctly set title and description
ockham 645616d
Try simplifying Add New button
ockham 5ed9ed7
Revert "Try simplifying Add New button"
ockham 232f3ba
phpcbf
ockham 275cc3c
When deleting, make sure we're not deleting a fallback template
ockham aaabafc
Add back original gutenberg_get_block_template and rename ours to gut…
ockham 190b1ed
Introduce resolve flag, use in site editor
ockham 21da936
Make fallback behavior the default
ockham 65b6e6b
phpcbf
ockham 5a1ef2b
Simplify new-template.js
ockham 32403a8
Revert "phpcbf"
ockham ec8804e
Revert "Make fallback behavior the default"
ockham 661fd91
Revert "Introduce resolve flag, use in site editor"
ockham e53448c
Revert "Add back original gutenberg_get_block_template and rename our…
ockham File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I feel the logic change here doesn't make sense, at least not from the
gutenberg_get_block_template
perspective, this is a low level API to retrieve a template given its ID. Potentially it can be moved to the endpoint to create a template but not while quering. WDYTThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's the big question here. I think that there's good arguments for each side:
gutenberg_get_block_template
(or "require a template given its ID") -- not just for the endpoint -- since it replicates what happens on the frontend, and it's likely that we always want to replicate that.I'll do a quick audit of all the other occurrences of
gutenberg_get_block_template
. If indeed I find that the fallback makes sense in all current cases, I'll probably opt to change it to that effect. (The argument then being YAGNI: If we currently only need it with the fallback, we should only provide it that way.)Another option would be to add a bool arg to the function signature to indicate whether or not to look for fallback templates or not, but I'd only do that if we find that we really need both versions of the function already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#37258 (comment)