Changeset 58057
- Timestamp:
- 04/30/2024 03:17:43 AM (6 months ago)
- Location:
- branches/6.5
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.5
-
branches/6.5/src/wp-includes/class-wp-theme-json.php
r58056 r58057 1228 1228 1229 1229 foreach ( $base_styles_nodes as $base_style_node ) { 1230 $stylesheet .= $this->get_layout_styles( $base_style_node );1230 $stylesheet .= $this->get_layout_styles( $base_style_node, $types ); 1231 1231 } 1232 1232 } … … 1390 1390 * @since 6.3.0 Reduced specificity for layout margin rules. 1391 1391 * @since 6.5.1 Only output rules referencing content and wide sizes when values exist. 1392 * @since 6.5.3 Add types parameter to check if only base layout styles are needed. 1392 1393 * 1393 1394 * @param array $block_metadata Metadata about the block to get styles for. 1395 * @param array $types Optional. Types of styles to output. If empty, all styles will be output. 1394 1396 * @return string Layout styles for the block. 1395 1397 */ 1396 protected function get_layout_styles( $block_metadata ) {1398 protected function get_layout_styles( $block_metadata, $types = array() ) { 1397 1399 $block_rules = ''; 1398 1400 $block_type = null; … … 1543 1545 foreach ( $base_style_rules as $base_style_rule ) { 1544 1546 $declarations = array(); 1547 1548 // Skip outputting base styles for flow and constrained layout types if theme doesn't support theme.json. The 'base-layout-styles' type flags this. 1549 if ( in_array( 'base-layout-styles', $types, true ) && ( 'default' === $layout_definition['name'] || 'constrained' === $layout_definition['name'] ) ) { 1550 continue; 1551 } 1545 1552 1546 1553 if ( -
branches/6.5/tests/phpunit/tests/theme/wpThemeJson.php
r58056 r58057 1261 1261 // Note the `base-layout-styles` includes a fallback gap for the Columns block for backwards compatibility. 1262 1262 $this->assertSame( 1263 ':where(.is-layout-flex){gap: 0.5em;}:where(.is-layout-grid){gap: 0.5em;}body .is-layout-fl ow > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}body .is-layout-flow > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}body .is-layout-flow > .aligncenter{margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > .alignleft{float: left;margin-inline-start: 0;margin-inline-end: 2em;}body .is-layout-constrained > .alignright{float: right;margin-inline-start: 2em;margin-inline-end: 0;}body .is-layout-constrained > .aligncenter{margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)){max-width: var(--wp--style--global--content-size);margin-left: auto !important;margin-right: auto !important;}body .is-layout-constrained > .alignwide{max-width: var(--wp--style--global--wide-size);}body .is-layout-flex{display: flex;}body .is-layout-flex{flex-wrap: wrap;align-items: center;}body .is-layout-flex > *{margin: 0;}body .is-layout-grid{display: grid;}body .is-layout-grid > *{margin: 0;}:where(.wp-block-columns.is-layout-flex){gap: 2em;}:where(.wp-block-columns.is-layout-grid){gap: 2em;}:where(.wp-block-post-template.is-layout-flex){gap: 1.25em;}:where(.wp-block-post-template.is-layout-grid){gap: 1.25em;}',1263 ':where(.is-layout-flex){gap: 0.5em;}:where(.is-layout-grid){gap: 0.5em;}body .is-layout-flex{display: flex;}body .is-layout-flex{flex-wrap: wrap;align-items: center;}body .is-layout-flex > *{margin: 0;}body .is-layout-grid{display: grid;}body .is-layout-grid > *{margin: 0;}:where(.wp-block-columns.is-layout-flex){gap: 2em;}:where(.wp-block-columns.is-layout-grid){gap: 2em;}:where(.wp-block-post-template.is-layout-flex){gap: 1.25em;}:where(.wp-block-post-template.is-layout-grid){gap: 1.25em;}', 1264 1264 $stylesheet 1265 1265 );
Note: See TracChangeset
for help on using the changeset viewer.