fix(collections): restore list items in posts with card indicator#4726
fix(collections): restore list items in posts with card indicator#4726laurelfulford wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Hotfix for Collections "Card" indicator style that was stripping inner blocks (e.g. <li> items in list blocks) by using $block['innerHTML'] instead of render_block().
Changes:
- Switch reassembly in
Content_Inserter::insert_after_nth_blockfrominnerHTMLtorender_block()so inner/dynamic blocks render correctly. - Add a regression test exercising a
core/listwithcore/list-itemchildren.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| includes/collections/class-content-inserter.php | Use render_block() to preserve inner-block content when reassembling parsed blocks. |
| tests/unit-tests/collections/class-test-content-inserter.php | Adds regression test verifying list items survive insertion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
85a5c9b to
02a4039
Compare
|
Closing in favour of the monorepo: Automattic/newspack-workspace#407. This fix was needed but the legacy #407 carries your change over verbatim ( |
All Submissions:
Changes proposed in this Pull Request:
In Collections, the 'Card' Collection Indicator Style used
$block['innerHTML'];to grab each block in the content, which accidentally dropped inner blocks like<li>in List blocks, or columns in Columns blocks.This hotfix switches it to use
render_block( $block );to preserve the inner blocks; it also adds a test for this specific case (making sure nested child blocks are preserved).Edited to add: this PR also includes a fix for a failing PHP test - in WP 7.0, the markup for paragraphs changed to add a
wp-block-paragraphCSS class, the Collections test should now reflect that, too.Closes NPPM-2831
How to test the changes in this Pull Request:
<ul>tags still exist, just the list items do not.Other information: