Skip to content

Commit

Permalink
Global Styles: Skip registration of variation styles when unsupported
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Jun 17, 2024
1 parent 4413591 commit 045c15a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/block-supports/block-style-variations.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,13 @@ function gutenberg_register_block_style_variations_from_theme_json_data( $variat
* @access private
*/
function gutenberg_register_block_style_variations_from_theme() {
$has_partials_directory = is_dir( get_stylesheet_directory() . '/styles' ) || is_dir( get_template_directory() . '/styles' );

// Skip any registration of styles if no theme.json or variation partials.
if ( ! wp_theme_has_theme_json() && ! $has_partials_directory ) {
return;
}

// Partials from `/styles`.
$variations_partials = WP_Theme_JSON_Resolver_Gutenberg::get_style_variations( 'block' );
gutenberg_register_block_style_variations_from_theme_json_data( $variations_partials );
Expand Down

0 comments on commit 045c15a

Please sign in to comment.