Changeset 51348 for trunk/src/wp-includes/blocks.php
- Timestamp:
- 07/06/2021 03:31:48 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks.php
r51298 r51348 711 711 ); 712 712 713 $allowed_blocks = array_merge( $allowed_inner_blocks, array( 'core/columns' ) ); 713 $allowed_wrapper_blocks = array( 714 'core/columns', 715 'core/column', 716 'core/group', 717 ); 718 719 $allowed_blocks = array_merge( $allowed_inner_blocks, $allowed_wrapper_blocks ); 714 720 715 721 /** … … 730 736 if ( in_array( $block['blockName'], $allowed_blocks, true ) ) { 731 737 if ( ! empty( $block['innerBlocks'] ) ) { 732 if ( 'core/columns' === $block['blockName']) {733 $output .= _excerpt_render_inner_ columns_blocks( $block, $allowed_inner_blocks );738 if ( in_array( $block['blockName'], $allowed_wrapper_blocks, true ) ) { 739 $output .= _excerpt_render_inner_blocks( $block, $allowed_blocks ); 734 740 continue; 735 741 } … … 754 760 755 761 /** 756 * Render inner blocks from the `core/columns` block for generating an excerpt. 757 * 758 * @since 5.2.0 762 * Render inner blocks from the allowed wrapper blocks 763 * for generating an excerpt. 764 * 765 * @since 5.8 759 766 * @access private 760 767 * 761 * @param array $ columns The parsed columnsblock.768 * @param array $parsed_block The parsed block. 762 769 * @param array $allowed_blocks The list of allowed inner blocks. 763 770 * @return string The rendered inner blocks. 764 771 */ 765 function _excerpt_render_inner_ columns_blocks( $columns, $allowed_blocks ) {772 function _excerpt_render_inner_blocks( $parsed_block, $allowed_blocks ) { 766 773 $output = ''; 767 774 768 foreach ( $columns['innerBlocks'] as $column ) { 769 foreach ( $column['innerBlocks'] as $inner_block ) { 770 if ( in_array( $inner_block['blockName'], $allowed_blocks, true ) && empty( $inner_block['innerBlocks'] ) ) { 771 $output .= render_block( $inner_block ); 772 } 775 foreach ( $parsed_block['innerBlocks'] as $inner_block ) { 776 if ( ! in_array( $inner_block['blockName'], $allowed_blocks, true ) ) { 777 continue; 778 } 779 780 if ( empty( $inner_block['innerBlocks'] ) ) { 781 $output .= render_block( $inner_block ); 782 } else { 783 $output .= _excerpt_render_inner_blocks( $inner_block, $allowed_blocks ); 773 784 } 774 785 }
Note: See TracChangeset
for help on using the changeset viewer.