Skip to content

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

Merged
Mamaduka merged 2 commits into
trunkfrom
fix/default-rendering-mode-condition
Dec 13, 2024
Merged

Plugin: Fix eligibility check for post types' default rendering mode#67879
Mamaduka merged 2 commits into
trunkfrom
fix/default-rendering-mode-condition

Conversation

@Mamaduka

Copy link
Copy Markdown
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
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
Copy Markdown
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.

@github-actions

github-actions Bot commented Dec 12, 2024

Copy link
Copy Markdown

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 <mamaduka@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>

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

@github-actions

Copy link
Copy Markdown

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
Copy Markdown
Member Author

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

@fabiankaegy fabiankaegy left a comment

Copy link
Copy Markdown
Member

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
@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
yogeshbhutkar pushed a commit to yogeshbhutkar/gutenberg that referenced this pull request Dec 18, 2024
…ordPress#67879)

* Plugin: Fix eligibility check for post types' default rendering mode
* Add backport changelog entry

Unlinked contributors: CreativeDive.

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
yogeshbhutkar pushed a commit to yogeshbhutkar/gutenberg that referenced this pull request Dec 18, 2024
…ordPress#67879)

* Plugin: Fix eligibility check for post types' default rendering mode
* Add backport changelog entry

Unlinked contributors: CreativeDive.

Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
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