-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Editor: Set new default rendering mode for Pages #8123
Editor: Set new default rendering mode for Pages #8123
Conversation
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 Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Thanks for the fixes! 😃 |
I'm considering making the new default mode for Pages conditional and only setting it when
Is the |
Yes, I don't see why not. Given that |
Anyway, I think it would be safer to implement this step by step, and perhaps not making it the default behavior for page-like post types for now, at least in hybrid/classic themes. |
632dda6
to
1397661
Compare
Synced the latest changes from WordPress/gutenberg#69160. This is ready for testing and approval. |
src/wp-includes/post.php
Outdated
@@ -69,6 +69,11 @@ function create_initial_post_types() { | |||
) | |||
); | |||
|
|||
// Enhance page editor for block themes by rendering template and content blocks. | |||
if ( wp_is_block_theme() ) { |
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.
if ( wp_is_block_theme() ) { | |
if ( wp_is_block_theme() && current_theme_supports( 'block-templates' ) ) { |
I think I'll need to harden this condition by adding a current_theme_supports
check. While it should be an edge case for a block theme not to support block-templates
, it's still technically doable. See: WordPress/gutenberg#67875 (comment).
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.
I like this more narrow approach for 6.8-beta1. Ideally, I'd like for us to accompany this change with a way to persistently store the user's preference so folks who do not want this default don't have to change the view each time they open a Page, but we can handle that in a follow-up.
Thanks. Option persistence is being tracked separately: WordPress/gutenberg#68250. I'll try to push an alternative PR for it before beta. However, that compromise seems to fall into the grey area of the "decisions, not options" philosophy. Let's continue the discussion on the issue. |
@Mamaduka One other observation about this PR is that it doesn't include the same add_action(
'init',
function() {
// Overwrite the editor support to remove default-mode.
add_post_type_support( 'page', 'editor' );
},
99 // Fire after post types are registered.
); |
Yes, that’s correct way to override it. I was planning including similar snippet in dev note. |
@Mamaduka I took the liberty of merging in trunk to allow for dev environments that have upgraded to bcrypt hashing to log in. |
I figured out the failing tests: The wordpress-develop/tests/phpunit/includes/abstract-testcase.php Lines 117 to 134 in 9acdbb9
Reflushing the cache after setting the post types up causes additional failures so I am not sure what the most straight forward approach is for ensuring the test suite is in an expected state. |
Thanks, @peterwilsoncc!
IIRC, the edit link should only be available for users with the correct capabilities. They're also displayed in WP 6.7, if you enable show template from the sidebar. Is the failing tests something we can resolve in test suite or do we need to change how new default is setup for Pages? Screenshot![]() |
It looks like we just need to fix the tests. Probably calling the cleanup process again in the |
@joemcgill, @peterwilsoncc, I would appreciate some guidance on that. |
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.
I've pushed a fix to the tests, modifying them to test the before and after values to ensure the notoption is stored in the correct cache.
Supersedes: #7129
Gutenberg PR: WordPress/gutenberg#68549
This update updates the
page
post-type definition and setstemplate-locked
as the new default rendering mode for the block editor.Trac ticket: https://core.trac.wordpress.org/ticket/61811
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.