Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upBlock Library: Add Post Content and Title Blocks. #18461
Conversation
| */ | ||
| function render_block_core_post_content() { | ||
| // TODO: Without this temporary fix, an infinite loop can occur. | ||
| if ( is_admin() || defined( 'REST_REQUEST' ) ) { |
This comment has been minimized.
This comment has been minimized.
youknowriad
Nov 13, 2019
Contributor
The logic of the condition is not clear. maybe expand on the comment. Also if this is temporary what's the ideal fix?
This comment has been minimized.
This comment has been minimized.
epiqueras
Nov 13, 2019
Author
Contributor
@felixarntz It's because in the admin views and in REST requests there is no post loop right? So the rest of this function becomes infinitely recursive?
Is there even a fix for this?
This comment has been minimized.
This comment has been minimized.
youknowriad
Nov 13, 2019
Contributor
I suppose this should be necessary for all post related blocks too.
For me, this is another reason the Post block is clearer as the condition becomes "is there a parent post context".
This comment has been minimized.
This comment has been minimized.
epiqueras
Nov 13, 2019
Author
Contributor
That wouldn't solve this and there is not currently a way for a parent post block to provide context for children during server rendering. You would be relying on the order in which the block tree is traversed while serializing which would be extremely fragile, specially when you start nesting post contexts.
Solving that shouldn't block this PR.
| if ( ! in_the_loop() ) { | ||
| rewind_posts(); | ||
| the_post(); | ||
| } |
This comment has been minimized.
This comment has been minimized.
youknowriad
Nov 13, 2019
Contributor
I noticed that this code is duplicated between post title and post content, As we discussed before, it seems to me that this code is better in a container "post" block. I'm ok moving forward without it and see where the limits of this approach lead us.
That said, we'll probably want to share that code across all post related blocks and avoid duplicating it.
This comment has been minimized.
This comment has been minimized.
epiqueras
Nov 13, 2019
Author
Contributor
We'll see. I still think it's valuable to support top level post children blocks like these. The post wrapper block should only be used to overwrite the current post context.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Nice work here. |
This comment has been minimized.
This comment has been minimized.
|
Excited to see this land. |
This comment has been minimized.
This comment has been minimized.
It's related to block template directory loading.
Me too |
32bdf92
to
15eaeab
This comment has been minimized.
This comment has been minimized.
|
@epiqueras do you know how this PR was landed despite the tests fail? |
This comment has been minimized.
This comment has been minimized.
|
Here the fix: #18543 |
This comment has been minimized.
This comment has been minimized.
|
Oops sorry, we have occasional timing related transform failures on PRs and I thought that was the case here so I ignored them. |
This comment has been minimized.
This comment has been minimized.
|
it's bad when we can't trust tests :( |
This comment has been minimized.
This comment has been minimized.
|
Maybe we should just disable fickle tests for now, since they seem to cause more harm than good. |




epiqueras commentedNov 12, 2019
Description
This PR adds the blocks from #17263, limiting the implementation to their front end rendering logic so that they can quickly be merged and used for building block templates without waiting for all the design considerations of #17263.
How has this been tested?
The blocks were added to a template and it was verified that previewing a post renders the template, filling in the placeholders appropriately.
Types of Changes
New Feature: Full Site Editing now has a Post Title and a Post Content Block.
Checklist: