-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Lib: Show error when resolved block template is empty. #20239
Lib: Show error when resolved block template is empty. #20239
Conversation
@WordPress/gutenberg-core Can we get this merged? It's a solid change regardless of how design decides to handle this later on. |
@@ -199,7 +199,7 @@ function gutenberg_find_template( $template_file ) { | |||
} | |||
} | |||
$_wp_current_template_id = $current_template_post->ID; | |||
$_wp_current_template_content = $current_template_post->post_content; | |||
$_wp_current_template_content = empty( $current_template_post->post_content ) ? 'Empty template.' : $current_template_post->post_content; |
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.
@epiqueras This string should likely be wrapped in a translation function like __(
.
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.
Closes #20201
Description
When a resolved block template was empty, the "No matching template found." error message was displayed. This was confusing to users because a template was found; it was just empty.
This PR handles these cases with an "Empty template." error message instead.
How to test this?
front-page
template is rendering.lib/demo-block-templates/front-page.html
.Types of Changes
New Feature: There is now a more granular error message to differentiate between when a block template is not found and when a block template is found, but it is empty.
Checklist: