Skip to content
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

Plugin: Fix eligibility check for post types' default rendering mode #67879

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

Mamaduka
Copy link
Member

What?

Fixes #67875.

PR fixes checks for adding a new default_rendering_mode to the post-type object, ensuring that the current theme supports block-template.

Testing Instructions

  1. Disabled block-template support for block theme.
  2. Open a page.
  3. Confirm that its content is correctly rendered.

Snippet

add_action( 'after_setup_theme', function() {
	remove_theme_support( 'block-templates' );
} );

Testing Instructions for Keyboard

Same.

@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Template Editing Mode Related to the template editor available in the Block Editor labels Dec 12, 2024
@Mamaduka Mamaduka self-assigned this Dec 12, 2024
@@ -32,15 +32,18 @@ function gutenberg_post_type_rendering_modes() {
* @return array Updated array of post type arguments.
*/
function gutenberg_post_type_default_rendering_mode( $args, $post_type ) {
$rendering_mode = 'page' === $post_type ? 'template-locked' : 'post-only';
$rendering_modes = gutenberg_post_type_rendering_modes();
if ( ! wp_is_block_theme() || ! current_theme_supports( 'block-templates' ) ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a rare case, but technically doable.

Copy link

github-actions bot commented Dec 12, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @CreativeDive.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: CreativeDive.

Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

Flaky tests detected in cbeea5f.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12298386191
📝 Reported issues:

@Mamaduka
Copy link
Member Author

If there are no objections, I'm going to merge this :)

Copy link
Member

@fabiankaegy fabiankaegy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! :)

@Mamaduka Mamaduka merged commit 7e85993 into trunk Dec 13, 2024
64 checks passed
@Mamaduka Mamaduka deleted the fix/default-rendering-mode-condition branch December 13, 2024 09:18
@github-actions github-actions bot added this to the Gutenberg 20.0 milestone Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Block Editor breaks after updating to Gutenberg 19.8.0 - Blocks missing inside the editor
2 participants