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. Built from https://develop.svn.wordpress.org/trunk@56055 git-svn-id: http://core.svn.wordpress.org/trunk@55567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -338,7 +338,7 @@ class WP_Theme_JSON {
|
||||
* @since 6.1.0 Added `layout.definitions` and `useRootPaddingAwareAlignments`.
|
||||
* @since 6.2.0 Added `dimensions.minHeight`, 'shadow.presets', 'shadow.defaultPresets',
|
||||
* `position.fixed` and `position.sticky`.
|
||||
* @since 6.3.0 Added support for `typography.textColumns`.
|
||||
* @since 6.3.0 Added support for `typography.textColumns`, removed `layout.definitions`.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
@@ -374,7 +374,6 @@ class WP_Theme_JSON {
|
||||
),
|
||||
'layout' => array(
|
||||
'contentSize' => null,
|
||||
'definitions' => null,
|
||||
'wideSize' => null,
|
||||
),
|
||||
'position' => array(
|
||||
@@ -1277,7 +1276,7 @@ class WP_Theme_JSON {
|
||||
|
||||
if ( isset( $block_metadata['name'] ) ) {
|
||||
$block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block_metadata['name'] );
|
||||
if ( ! block_has_support( $block_type, array( '__experimentalLayout' ), false ) ) {
|
||||
if ( ! block_has_support( $block_type, array( 'layout' ), false ) && ! block_has_support( $block_type, array( '__experimentalLayout' ), false ) ) {
|
||||
return $block_rules;
|
||||
}
|
||||
}
|
||||
@@ -1286,7 +1285,7 @@ class WP_Theme_JSON {
|
||||
$has_block_gap_support = _wp_array_get( $this->theme_json, array( 'settings', 'spacing', 'blockGap' ) ) !== null;
|
||||
$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.
|
||||
$node = _wp_array_get( $this->theme_json, $block_metadata['path'], array() );
|
||||
$layout_definitions = _wp_array_get( $this->theme_json, array( 'settings', 'layout', 'definitions' ), array() );
|
||||
$layout_definitions = wp_get_layout_definitions();
|
||||
$layout_selector_pattern = '/^[a-zA-Z0-9\-\.\ *+>:\(\)]*$/'; // Allow alphanumeric classnames, spaces, wildcard, sibling, child combinator and pseudo class selectors.
|
||||
|
||||
// Gap styles will only be output if the theme has block gap support, or supports a fallback gap.
|
||||
|
||||
Reference in New Issue
Block a user