wp-includes/block-supports/layout.php:109Returns child layout styles for a block affected by its parent's layout.
$selectorstring$child_layoutarray$parent_layoutarrayoptionalarray()$viewport_overridesarray|nulloptionalnullarrayfunction wp_get_child_layout_style_rules( $selector, $child_layout, $parent_layout = array(), $viewport_overrides = null ) { $base_child_layout = is_array( $child_layout ) ? $child_layout : array(); $viewport_overrides = is_array( $viewport_overrides ) ? $viewport_overrides : null; $child_layout = null === $viewport_overrides ? $base_child_layout : array_replace( $base_child_layout, $viewport_overrides ); $child_layout_declarations = array(); $child_layout_styles = array(); $has_viewport_property_override = static function ( $property ) use ( $viewport_overrides ) { return array_key_exists( $property, $viewport_overrides ); }; $self_stretch = $child_layout['selfStretch'] ?? null; $base_self_stretch = $base_child_layout['selfStretch'] ?? null; /* * These are the serialized `selfStretch` values. `max` used to be called * "Fixed" in the UI, but was renamed and replaced by `fixedNoShrink`. */ $flex_child_layout_values = array( 'fit' => 'fit', 'grow' => 'fill', 'max' => 'fixed', 'fixed' => 'fixedNoShrink', ); $flex_size_values = array( $flex_child_layout_values['max'], $flex_child_layout_values['fixed'], ); if ( null === $viewport_overrides || $has_viewport_property_override( 'selfStretch' ) || $has_viewport_property_override( 'flexSize' ) ) { if ( null !== $viewport_overrides && ( $flex_child_layout_values['fit'] === $self_stretch || $flex_child_layout_values['grow'] === $self_stretch ) && in_array( $base_self_stretch, $flex_size_values, true ) && isset( $base_child_layout['flexSize'] ) ) { $child_layout_declarations['flex-basis'] = 'unset'; if ( $flex_child_layout_values['fixed'] === $base_self_stretch ) { $child_layout_declarations['flex-shrink'] = 'unset'; } } if ( in_array( $self_stretch, $flex_size_values, true ) && isset( $child_layout['flexSize'] ) ) { $child_layout_declarations['flex-basis'] = $child_layout['flexSize']; if ( $flex_child_layout_values['fixed'] === $self_stretch ) { $child_layout_declarations['flex-shrink'] = '0'; } elseif ( null !== $viewport_overrides && $flex_child_layout_values['fixed'] === $base_self_stretch ) { $child_layout_declarations['flex-shrink'] = 'unset'; } $child_layout_declarations['box-sizing'] = 'border-box'; } elseif ( $flex_child_layout_values['grow'] === $self_stretch ) { $child_layout_declarations['flex-grow'] = '1'; } } $column_start = $child_layout['columnStart'] ?? null; $column_span = $child_layout['columnSpan'] ?? null; if ( null === $viewport_overrides || $has_viewport_property_override( 'columnStart' ) || $has_viewport_property_override( 'columnSpan' ) ) { if ( $column_start && $column_span ) { $child_layout_declarations['grid-column'] = "$column_start / span $column_span"; } elseif ( $column_start ) { $child_layout_declarations['grid-column'] = "$column_start"; } elseif ( $column_span ) { $child_layout_declarations['grid-column'] = "span $column_span"; } } $row_start = $child_layout['rowStart'] ?? null; $row_span = $child_layout['rowSpan'] ?? null; if ( null === $viewport_overrides || $has_viewport_property_override( 'rowStart' ) || $has_viewport_property_override( 'rowSpan' ) ) { if ( $row_start && $row_span ) { $child_layout_declarations['grid-row'] = "$row_start / span $row_span"; } elseif ( $row_start ) { $child_layout_declarations['grid-row'] = "$row_start"; } elseif ( $row_span ) { $child_layout_declarations['grid-row'] = "span $row_span"; } } if ( ! empty( $child_layout_declarations ) ) { $child_layout_styles[] = array( 'selector' => $selector,Introduced in 7.1.0.
Signature, return type and hooks compared across 1 parsed release.
src/wp-includes/block-supports/layout.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.