Skip to content

Commit

Permalink
Backport #5797 to 17.x.x branch (#5799)
Browse files Browse the repository at this point in the history
  • Loading branch information
ichim-david committed Feb 27, 2024
1 parent 0547753 commit 1c3f1bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/5796.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enhance findBlocks to check for blocks also in data for add-ons such as @eeacms/volto-tabs-block. @ichim-david
7 changes: 5 additions & 2 deletions src/helpers/Blocks/Blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,13 @@ export function findBlocks(blocks, types, result = []) {

Object.keys(blocks).forEach((blockId) => {
const block = blocks[blockId];
// check blocks from data as well since some add-ons use that
// such as @eeacms/volto-tabs-block
const child_blocks = block.blocks || block.data?.blocks;
if (types.includes(block['@type'])) {
result.push(blockId);
} else if (containerBlockTypes.includes(block['@type']) || block.blocks) {
findBlocks(block.blocks, types, result);
} else if (containerBlockTypes.includes(block['@type']) || child_blocks) {
findBlocks(child_blocks, types, result);
}
});

Expand Down

0 comments on commit 1c3f1bf

Please sign in to comment.