wp-includes/block-supports/layout.php:955Renders the layout config to the block wrapper.
$block_contentstring$blockarraystringfunction wp_render_layout_support_flag( $block_content, $block ) { static $global_styles = null; $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] ); $block_supports_layout = block_has_support( $block_type, 'layout', false ) || block_has_support( $block_type, '__experimentalLayout', false ); $style_attr = $block['attrs']['style'] ?? array(); /* * A block with no layout support and no style attribute at all cannot * produce layout output, so return before resolving global settings. * * Resolving settings is not read-only: on a cold cache it queries the * user's `wp_global_styles` post, which fires `the_posts`. A callback on * that hook that renders blocks re-enters this filter, and the content it * renders at that point is the global styles post itself, which parses to a * single block with no name and no attributes. Without this return that * block resolves settings again and the recursion has no base case. */ if ( ! $block_supports_layout && empty( $style_attr ) ) { return $block_content; } $global_settings = wp_get_global_settings(); $viewport_settings = $global_settings['viewport'] ?? null; $responsive_media_queries = WP_Theme_JSON::get_viewport_media_queries( $viewport_settings ); $child_layout = $style_attr['layout'] ?? null; /* * Collect responsive viewport child layout overrides so that a block with * only responsive child layout (no base child layout) is still processed. */ $viewport_child_layouts = array(); foreach ( $responsive_media_queries as $breakpoint => $media_query ) { $viewport_child = wp_get_layout_child_values( $style_attr[ $breakpoint ]['layout'] ?? null ); if ( ! empty( $viewport_child ) ) { $viewport_child_layouts[ $breakpoint ] = array( 'media_query' => $media_query, 'child_layout' => $viewport_child, ); } } if ( ! $block_supports_layout && ! $child_layout && empty( $viewport_child_layouts ) ) { return $block_content; } $outer_class_names = array(); // Child layout specific logic. if ( $child_layout || ! empty( $viewport_child_layouts ) ) { $base_child_layout = wp_get_layout_child_values( $child_layout ); $parent_layout = $block['parentLayout'] ?? array(); /* * Generates a unique class for child block layout styles. * * To ensure consistent class generation across different page renders, * only properties that affect layout styling are used. These properties * come from `$block['attrs']['style']['layout']`, viewport overrides in * `$block['attrs']['style'][$breakpoint]['layout']`, and `$block['parentLayout']`. * * As long as these properties coincide, the generated class will be the same. */ $container_content_hash_input = array( 'layout' => $base_child_layout, 'parentLayout' => array_intersect_key( $parent_layout, array_flip( array( 'minimumColumnWidth', 'columnCount' ) ) ), ); foreach ( $viewport_child_layouts as $breakpoint => $viewport_data ) { $container_content_hash_input[ $breakpoint ] = $viewport_data['child_layout']; } $container_content_class = wp_unique_id_from_values( $container_content_hash_input, 'wp-container-content-' ); $child_layout_styles = wp_get_child_layout_style_rules( ".$container_content_class", $base_child_layout, $parent_layout );Introduced in 5.8.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/block-supports/layout.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.