Make WordPress Core

Changeset 55201


Ignore:
Timestamp:
02/03/2023 12:34:59 AM (4 years ago)
Author:
hellofromTonya
Message:

Editor: Add missing controls to flex layouts in wp_get_layout_style().

Adds missing controls to flex layouts in wp_get_layout_style() for justify-content and vertical alignment options.

References:

Follow-up to [54274].

Props isabel_brison, andrewserong, jameskoster, joen, onemaggie , ndiego.
Fixes #57602.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/layout.php

    r55167 r55201  
    208208
    209209                if ( 'horizontal' === $layout_orientation ) {
    210                         $justify_content_options += array( 'space-between' => 'space-between' );
     210                        $justify_content_options    += array( 'space-between' => 'space-between' );
     211                        $vertical_alignment_options += array( 'stretch' => 'stretch' );
     212                } else {
     213                        $justify_content_options    += array( 'stretch' => 'stretch' );
     214                        $vertical_alignment_options += array( 'space-between' => 'space-between' );
    211215                }
    212216
     
    275279                                        'selector'     => $selector,
    276280                                        'declarations' => array( 'align-items' => 'flex-start' ),
     281                                );
     282                        }
     283                        if ( ! empty( $layout['verticalAlignment'] ) && array_key_exists( $layout['verticalAlignment'], $vertical_alignment_options ) ) {
     284                                $layout_styles[] = array(
     285                                        'selector'     => $selector,
     286                                        'declarations' => array( 'justify-content' => $vertical_alignment_options[ $layout['verticalAlignment'] ] ),
    277287                                );
    278288                        }
  • trunk/tests/phpunit/tests/block-supports/wpGetLayoutStyle.php

    r54311 r55201  
    247247                                        ),
    248248                                ),
    249                                 'expected_output' => '.wp-layout{flex-wrap:nowrap;flex-direction:column;align-items:flex-start;}',
     249                                'expected_output' => '.wp-layout{flex-wrap:nowrap;flex-direction:column;align-items:flex-start;justify-content:flex-end;}',
    250250                        ),
    251251                        'default layout with blockGap to verify converting gap value into valid CSS' => array(
Note: See TracChangeset for help on using the changeset viewer.