Opened 4 weeks ago
Last modified 3 weeks ago
#63580 new defect (bug)
render_block does not render innerblocks when used explicitly
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | trunk |
Component: | Editor | Keywords: | 2nd-opinion |
Focuses: | Cc: |
Description
When using render_blocks explicitly, it doesn't render the nested blocks if they don't have any innerContent defined in them.
I believe this shouldn't be the case as some parent blocks like core/column shouldn't won't necessarily have innerContent when other blocks are present inside them.
For example, this doesn't render the content of the nested paragraph blocks
<?php $first_column_blocks = [ [ 'blockName' => 'core/paragraph', 'attrs' => [], 'innerBlocks' => [], 'innerHTML' => '<p>This is the first column demo content.</p>', 'innerContent' => [ '<p>This is the first column demo content.</p>', ], ], ]; $second_column_blocks = [ [ 'blockName' => 'core/paragraph', 'attrs' => [], 'innerBlocks' => [], 'innerHTML' => '<p>This is the second column demo content.</p>', 'innerContent' => [ '<p>This is the second column demo content.</p>', ], ], ]; $column_layout_block = [ 'blockName' => 'core/columns', 'attrs' => [], 'innerBlocks' => [ [ 'blockName' => 'core/column', 'attrs' => [], 'innerBlocks' => $first_column_blocks ], [ 'blockName' => 'core/column', 'attrs' => [], 'innerBlocks' => $second_column_blocks ], ] ];
For markup generated by Gutenberg, there is some innerContent generated hence, it doesn't the same issue. But I don't think a developer is expected to pass this content in explicitly [demonstrated in linked image]
More info present in Gutenberg ticket linked below
This issue was originally reported by Andreas Lindahl as an Issue on Gutenberg repository
https://github.com/WordPress/gutenberg/issues/69307
innerContent generated by same layout created in Gutenberg editor instead