Make WordPress Core


Ignore:
Timestamp:
01/23/2024 05:36:40 AM (3 years ago)
Author:
isabel_brison
Message:

Editor: fix classname output on blocks without layout.

Prevents layout classnames from being output on blocks with no layout support and no child layout classnames by returning early from wp_render_layout_support_flag.

Props andrewserong.
Fixes #60292.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/block-supports/layout.php

    r57246 r57328  
    172172         * @ticket 57584
    173173         * @ticket 58548
     174         * @ticket 60292
    174175         *
    175176         * @dataProvider data_layout_support_flag_renders_classnames_on_wrapper
    … …  
    251252                                'expected_output' => '<div class="wp-block-group"><div class="wp-block-group__inner-wrapper is-layout-flow wp-block-group-is-layout-flow"></div></div>',
    252253                        ),
     254                        'skip classname output if block does not support layout and there are no child layout classes to be output' => array(
     255                                'args'            => array(
     256                                        'block_content' => '<p>A paragraph</p>',
     257                                        'block'         => array(
     258                                                'blockName'    => 'core/paragraph',
     259                                                'attrs'        => array(
     260                                                        'style' => array(
     261                                                                'layout' => array(
     262                                                                        'selfStretch' => 'fit',
     263                                                                ),
     264                                                        ),
     265                                                ),
     266                                                'innerBlocks'  => array(),
     267                                                'innerHTML'    => '<p>A paragraph</p>',
     268                                                'innerContent' => array( '<p>A paragraph</p>' ),
     269                                        ),
     270                                ),
     271                                'expected_output' => '<p>A paragraph</p>',
     272                        ),
    253273                );
    254274        }
Note: See TracChangeset for help on using the changeset viewer.