Make WordPress Core


Ignore:
Timestamp:
06/27/2023 07:23:04 AM (2 years ago)
Author:
isabel_brison
Message:

Editor: stabilise layout and refactor definitions.

Marks the layout support stable and moves layout definitions from theme.json into wp-includes/block-supports/layout.php.

Props andrewserong, poena, ramonopoly, peterwilsoncc.
Fixes #58550.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r56041 r56055  
    339339     * @since 6.2.0 Added `dimensions.minHeight`, 'shadow.presets', 'shadow.defaultPresets',
    340340     *              `position.fixed` and `position.sticky`.
    341      * @since 6.3.0 Added support for `typography.textColumns`.
     341     * @since 6.3.0 Added support for `typography.textColumns`, removed `layout.definitions`.
    342342     *
    343343     * @var array
     
    375375        'layout'                        => array(
    376376            'contentSize' => null,
    377             'definitions' => null,
    378377            'wideSize'    => null,
    379378        ),
     
    12781277        if ( isset( $block_metadata['name'] ) ) {
    12791278            $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block_metadata['name'] );
    1280             if ( ! block_has_support( $block_type, array( '__experimentalLayout' ), false ) ) {
     1279            if ( ! block_has_support( $block_type, array( 'layout' ), false ) && ! block_has_support( $block_type, array( '__experimentalLayout' ), false ) ) {
    12811280                return $block_rules;
    12821281            }
     
    12871286        $has_fallback_gap_support = ! $has_block_gap_support; // This setting isn't useful yet: it exists as a placeholder for a future explicit fallback gap styles support.
    12881287        $node                     = _wp_array_get( $this->theme_json, $block_metadata['path'], array() );
    1289         $layout_definitions       = _wp_array_get( $this->theme_json, array( 'settings', 'layout', 'definitions' ), array() );
     1288        $layout_definitions       = wp_get_layout_definitions();
    12901289        $layout_selector_pattern  = '/^[a-zA-Z0-9\-\.\ *+>:\(\)]*$/'; // Allow alphanumeric classnames, spaces, wildcard, sibling, child combinator and pseudo class selectors.
    12911290
Note: See TracChangeset for help on using the changeset viewer.