Skip to content

Commit

Permalink
Remove no longer required option to skip root layout styles
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Dec 22, 2023
1 parent 71fbbf9 commit 8ef0c8a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
3 changes: 1 addition & 2 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -1233,8 +1233,7 @@ public function get_stylesheet( $types = array( 'variables', 'styles', 'presets'
}

if ( in_array( 'styles', $types, true ) ) {
$skip_root_layout_styles = $options['skip_root_layout_styles'] ?? false;
if ( false !== $root_style_key && ! $skip_root_layout_styles ) {
if ( false !== $root_style_key ) {
$stylesheet .= $this->get_root_layout_rules( $style_nodes[ $root_style_key ]['selector'], $style_nodes[ $root_style_key ] );
}
$stylesheet .= $this->get_block_classes( $style_nodes );
Expand Down
29 changes: 0 additions & 29 deletions phpunit/class-wp-theme-json-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,35 +217,6 @@ public function test_get_stylesheet_skips_layout_styles() {
);
}

public function test_get_stylesheet_skips_root_layout_styles() {
$theme_json = new WP_Theme_JSON_Gutenberg(
array(
'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA,
'styles' => array(
'blocks' => array(
'core/group' => array(
'color' => array(
'background' => 'deepskyblue',
),
),
),
),
),
'blocks'
);
$stylesheet = $theme_json->get_stylesheet(
array( 'styles' ),
array( 'custom' ),
array( 'skip_root_layout_styles' => true )
);

// All Layout styles should be skipped.
$this->assertEquals(
'.wp-block-group{background-color: deepskyblue;}',
$stylesheet
);
}

public function test_get_stylesheet() {
$theme_json = new WP_Theme_JSON_Gutenberg(
array(
Expand Down

0 comments on commit 8ef0c8a

Please sign in to comment.