| @@ -320,11 +320,11 @@ | ||
| 320 | 320 | |
| 321 | 321 | /** |
| 322 | 322 | * Returns child layout styles for a block affected by its parent's layout. |
| 323 | 323 | * |
| 324 | - * @param string $selector CSS selector. | |
| 325 | - * @param array $child_layout Child layout values. | |
| 326 | - * @param array $parent_layout Parent layout values. | |
| 324 | + * @param string $selector CSS selector. | |
| 325 | + * @param array $child_layout Child layout values. | |
| 326 | + * @param array $parent_layout Parent layout values. | |
| 327 | 327 | * @param array|null $viewport_overrides Optional. Child viewport layout overrides to emit. |
| 328 | 328 | * @return array Child layout style rules. |
| 329 | 329 | */ |
| 330 | 330 | function gutenberg_get_child_layout_style_rules( $selector, $child_layout, $parent_layout = array(), $viewport_overrides = null ) { |
| @@ -789,8 +789,19 @@ | ||
| 789 | 789 | $flex_vertical_alignment = $layout_for_styles['verticalAlignment'] ?? null; |
| 790 | 790 | |
| 791 | 791 | if ( 'horizontal' === $layout_orientation ) { |
| 792 | 792 | /* |
| 793 | + * `row` is the flex default, so the base layout never declares it. A viewport | |
| 794 | + * override that switches a vertical base layout to horizontal has to declare | |
| 795 | + * it explicitly, otherwise the base `flex-direction: column` keeps applying. | |
| 796 | + */ | |
| 797 | + if ( null !== $viewport_overrides && $has_viewport_property_override( 'orientation' ) ) { | |
| 798 | + $layout_styles[] = array( | |
| 799 | + 'selector' => $selector, | |
| 800 | + 'declarations' => array( 'flex-direction' => 'row' ), | |
| 801 | + ); | |
| 802 | + } | |
| 803 | + /* | |
| 793 | 804 | * Add this style only if is not empty for backwards compatibility, |
| 794 | 805 | * since we intend to convert blocks that had flex layout implemented |
| 795 | 806 | * by custom css. |
| 796 | 807 | */ |
| @@ -973,10 +984,10 @@ | ||
| 973 | 984 | * and increments on each call. The returned value is not universally unique, |
| 974 | 985 | * but it is unique across the life of the PHP process and it's stable per |
| 975 | 986 | * prefix. |
| 976 | 987 | * |
| 977 | - * @param string $prefix Prefix for the returned ID. | |
| 978 | - * @return string Incremental ID per prefix. | |
| 988 | + * @param string $prefix Prefix for the returned ID. | |
| 989 | + * @return string Incremental ID per prefix. | |
| 979 | 990 | */ |
| 980 | 991 | function gutenberg_incremental_id_per_prefix( $prefix = '' ) { |
| 981 | 992 | static $id_counters = array(); |
| 982 | 993 | if ( ! array_key_exists( $prefix, $id_counters ) ) { |
| @@ -1005,11 +1016,11 @@ | ||
| 1005 | 1016 | |
| 1006 | 1017 | /** |
| 1007 | 1018 | * Renders the layout config to the block wrapper. |
| 1008 | 1019 | * |
| 1009 | - * @param string $block_content Rendered block content. | |
| 1010 | - * @param array $block Block object. | |
| 1011 | - * @return string Filtered block content. | |
| 1020 | + * @param string $block_content Rendered block content. | |
| 1021 | + * @param array $block Block object. | |
| 1022 | + * @return string Filtered block content. | |
| 1012 | 1023 | */ |
| 1013 | 1024 | function gutenberg_render_layout_support_flag( $block_content, $block ) { |
| 1014 | 1025 | $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] ); |
| 1015 | 1026 | $block_supports_layout = block_has_support( $block_type, array( 'layout' ), false ) || block_has_support( $block_type, array( '__experimentalLayout' ), false ); |
| @@ -1524,11 +1535,11 @@ | ||
| 1524 | 1535 | * For themes without theme.json file, make sure |
| 1525 | 1536 | * to restore the inner div for the group block |
| 1526 | 1537 | * to avoid breaking styles relying on that div. |
| 1527 | 1538 | * |
| 1528 | - * @param string $block_content Rendered block content. | |
| 1529 | - * @param array $block Block object. | |
| 1530 | - * @return string Filtered block content. | |
| 1539 | + * @param string $block_content Rendered block content. | |
| 1540 | + * @param array $block Block object. | |
| 1541 | + * @return string Filtered block content. | |
| 1531 | 1542 | */ |
| 1532 | 1543 | function gutenberg_restore_group_inner_container( $block_content, $block ) { |
| 1533 | 1544 | $tag_name_attr = $block['attrs']['tagName'] ?? null; |
| 1534 | 1545 | $tag_name = is_string( $tag_name_attr ) ? $tag_name_attr : 'div'; |
| @@ -1598,9 +1609,9 @@ | ||
| 1598 | 1609 | * to restore the outer div for the aligned image block |
| 1599 | 1610 | * to avoid breaking styles relying on that div. |
| 1600 | 1611 | * |
| 1601 | 1612 | * @param string $block_content Rendered block content. |
| 1602 | - * @param array $block Block object. | |
| 1613 | + * @param array $block Block object. | |
| 1603 | 1614 | * @return string Filtered block content. |
| 1604 | 1615 | */ |
| 1605 | 1616 | function gutenberg_restore_image_outer_container( $block_content, $block ) { |
| 1606 | 1617 | if ( wp_theme_has_theme_json() ) { |