Changeset 60038 for trunk/src/wp-includes/block-supports/layout.php
- Timestamp:
- 03/18/2025 12:41:31 PM (8 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/layout.php
r58750 r60038 581 581 // Child layout specific logic. 582 582 if ( $child_layout ) { 583 $container_content_class = wp_unique_prefixed_id( 'wp-container-content-' ); 583 /* 584 * Generates a unique class for child block layout styles. 585 * 586 * To ensure consistent class generation across different page renders, 587 * only properties that affect layout styling are used. These properties 588 * come from `$block['attrs']['style']['layout']` and `$block['parentLayout']`. 589 * 590 * As long as these properties coincide, the generated class will be the same. 591 */ 592 $container_content_class = wp_unique_id_from_values( 593 array( 594 'layout' => array_intersect_key( 595 $block['attrs']['style']['layout'] ?? array(), 596 array_flip( 597 array( 'selfStretch', 'flexSize', 'columnStart', 'columnSpan', 'rowStart', 'rowSpan' ) 598 ) 599 ), 600 'parentLayout' => array_intersect_key( 601 $block['parentLayout'] ?? array(), 602 array_flip( 603 array( 'minimumColumnWidth', 'columnCount' ) 604 ) 605 ), 606 ), 607 'wp-container-content-' 608 ); 609 584 610 $child_layout_declarations = array(); 585 611 $child_layout_styles = array(); … … 707 733 $layout_definitions = wp_get_layout_definitions(); 708 734 709 /*710 * Uses an incremental ID that is independent per prefix to make sure that711 * rendering different numbers of blocks doesn't affect the IDs of other712 * blocks. Makes the CSS class names stable across paginations713 * for features like the enhanced pagination of the Query block.714 */715 $container_class = wp_unique_prefixed_id(716 'wp-container-' . sanitize_title( $block['blockName'] ) . '-is-layout-'717 );718 719 735 // Set the correct layout type for blocks using legacy content width. 720 736 if ( isset( $used_layout['inherit'] ) && $used_layout['inherit'] || isset( $used_layout['contentSize'] ) && $used_layout['contentSize'] ) { … … 806 822 : null; 807 823 $has_block_gap_support = isset( $block_gap ); 824 825 /* 826 * Generates a unique ID based on all the data required to obtain the 827 * corresponding layout style. Keeps the CSS class names the same 828 * even for different blocks on different places, as long as they have 829 * the same layout definition. Makes the CSS class names stable across 830 * paginations for features like the enhanced pagination of the Query block. 831 */ 832 $container_class = wp_unique_id_from_values( 833 array( 834 $used_layout, 835 $has_block_gap_support, 836 $gap_value, 837 $should_skip_gap_serialization, 838 $fallback_gap_value, 839 $block_spacing, 840 ), 841 'wp-container-' . sanitize_title( $block['blockName'] ) . '-is-layout-' 842 ); 808 843 809 844 $style = wp_get_layout_style(
Note: See TracChangeset
for help on using the changeset viewer.