Repository navigation
Template activation: remove fake post type for registered templates - #72674
Conversation
|
Size Change: -28 B (0%) Total Size: 2.27 MB
ℹ️ View Unchanged
|
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
| } ) | ||
| ?.find( ( { slug } ) => slug === currentTemplateSlug ); | ||
| if ( currentTemplate ) { | ||
| return currentTemplate.id; |
There was a problem hiding this comment.
This should have been done in #72661 because it specifically handles the template property on a post object.
|
Flaky tests detected in 70bd465. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18789424878
|
|
I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: ecc13df |
| if ( select.__unstableIsEditorReady() ) { | ||
| if ( | ||
| select.__unstableIsEditorReady() && | ||
| ! select.getEditorSettings().isPreviewMode |
There was a problem hiding this comment.
@ellatrix: based on
There's a little fix we have to do in setRenderingMode: since these templates are not posts and not editable, we shouldn't call editPost because that will error (tries to get a post type entity). The fix is to check if the editor is in preview mode.
Wouldn't that mean that it's worth still calling clearSelectedBlock?
Developed in #10425. See https://core.trac.wordpress.org/ticket/62755. * Rename new endpoints, WordPress/gutenberg#72700. * Remove fake post type for registered templates, WordPress/gutenberg#72674. * Remove the ability to deactivate registered templates, WordPress/gutenberg#72636, * Fix undefined array key PHP warning, WordPress/gutenberg#72729. * Add migration logic (to be refined), see https://core.trac.wordpress.org/ticket/64133 and #10418. Fixes #62755. Props ellatrix, priethor. git-svn-id: https://develop.svn.wordpress.org/trunk@61078 602fd350-edb4-49c9-b593-d223f7449a82
Developed in WordPress/wordpress-develop#10425. See https://core.trac.wordpress.org/ticket/62755. * Rename new endpoints, WordPress/gutenberg#72700. * Remove fake post type for registered templates, WordPress/gutenberg#72674. * Remove the ability to deactivate registered templates, WordPress/gutenberg#72636, * Fix undefined array key PHP warning, WordPress/gutenberg#72729. * Add migration logic (to be refined), see https://core.trac.wordpress.org/ticket/64133 and WordPress/wordpress-develop#10418. Fixes #62755. Props ellatrix, priethor. Built from https://develop.svn.wordpress.org/trunk@61078 git-svn-id: http://core.svn.wordpress.org/trunk@60414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Developed in WordPress/wordpress-develop#10425. See https://core.trac.wordpress.org/ticket/62755. * Rename new endpoints, WordPress/gutenberg#72700. * Remove fake post type for registered templates, WordPress/gutenberg#72674. * Remove the ability to deactivate registered templates, WordPress/gutenberg#72636, * Fix undefined array key PHP warning, WordPress/gutenberg#72729. * Add migration logic (to be refined), see https://core.trac.wordpress.org/ticket/64133 and WordPress/wordpress-develop#10418. Fixes #62755. Props ellatrix, priethor. Built from https://develop.svn.wordpress.org/trunk@61078 git-svn-id: https://core.svn.wordpress.org/trunk@60414 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
What?
Closes #72578. Removes the
wp_registered_template"post type".Why?
Because it doesn't exist, it was to work around getting an editor preview and having entities be automatically available in the editor.
How?
Instead, we should create an entity manually. We get rid of any mention of the
wp_registered_template.There's a little fix we have to do in
setRenderingMode: since these templates are not posts and not editable, we shouldn't calleditPostbecause that will error (tries to get a post type entity). The fix is to check if the editor is in preview mode.Testing Instructions
Everything should work as before and e2e tests should pass.
Testing Instructions for Keyboard
Screenshots or screencast