Changeset 53012 for trunk/src/wp-includes/block-supports/layout.php
- Timestamp:
- 03/29/2022 01:04:24 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/layout.php
r52924 r53012 159 159 } 160 160 161 $ id = uniqid();162 $gap_value = _wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) );161 $class_name = wp_unique_id( 'wp-container-' ); 162 $gap_value = _wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) ); 163 163 // Skip if gap value contains unsupported characters. 164 164 // Regex for CSS value borrowed from `safecss_filter_attr`, and used here 165 165 // because we only want to match against the value, not the CSS attribute. 166 166 $gap_value = preg_match( '%[\\\(&=}]|/\*%', $gap_value ) ? null : $gap_value; 167 $style = wp_get_layout_style( ". wp-container-$id", $used_layout, $has_block_gap_support, $gap_value );167 $style = wp_get_layout_style( ".$class_name", $used_layout, $has_block_gap_support, $gap_value ); 168 168 // This assumes the hook only applies to blocks with a single wrapper. 169 169 // I think this is a reasonable limitation for that particular hook. 170 170 $content = preg_replace( 171 171 '/' . preg_quote( 'class="', '/' ) . '/', 172 'class=" wp-container-' . $id. ' ',172 'class="' . esc_attr( $class_name ) . ' ', 173 173 $block_content, 174 174 1
Note: See TracChangeset
for help on using the changeset viewer.