Skip to content

Commit bdc3c2e

Browse files
carolinanscruffian
authored andcommitted
Try to fix coding standard issues
1 parent b49cba2 commit bdc3c2e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/global-styles-and-settings.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,20 @@ function gutenberg_get_theme_directory_pattern_slugs() {
291291
return WP_Theme_JSON_Resolver_Gutenberg::get_theme_data( array(), array( 'with_supports' => false ) )->get_patterns();
292292
}
293293

294-
function add_variation_class_to_body( $classes ) {
294+
/**
295+
* Adds the `uses-style-variation` and `is-style-variation-name` classes to the body if a theme style variation is used.
296+
*
297+
* @since 6.4.0
298+
*
299+
* @param array $classes Classes for the body element.
300+
* @return array Filtered classes for the body element.
301+
*/
302+
function gutenberg_add_variation_class_to_body( $classes ) {
295303
$custom = wp_get_global_settings( array( 'custom' ) );
296-
if ( isset($custom['variation']) && 'Default' !== $custom['variation'] ) {
304+
if ( isset( $custom['variation'] ) && 'Default' !== $custom['variation'] ) {
297305
$classes[] = 'uses-style-variation';
298-
$classes[] = _wp_to_kebab_case('is style variation ' . $custom['variation']);
306+
$classes[] = _wp_to_kebab_case( 'is style variation ' . $custom['variation'] );
299307
}
300308
return $classes;
301309
}
302-
add_filter( 'body_class','add_variation_class_to_body' );
310+
add_filter( 'body_class', 'gutenberg_add_variation_class_to_body' );

0 commit comments

Comments
 (0)