Avoid duplicate custom classnames (#51910)

* Avoid duplicate custom classnames

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-10-23 12:52:28 +02:00 committed by GitHub
parent a6d09c9133
commit 1e8b6d6b76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 13 additions and 10 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Avoid duplicate custom classnames

View File

@ -169,9 +169,9 @@ class AddToCartForm extends AbstractBlock {
$product = $this->add_is_descendent_of_single_product_block_hidden_input_to_product_form( $product, $is_descendent_of_single_product_block ); $product = $this->add_is_descendent_of_single_product_block_hidden_input_to_product_form( $product, $is_descendent_of_single_product_block );
} }
$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, array(), array( 'extra_classes' ) );
$product = $this->add_classes_to_add_to_cart_form_input( $product, $attributes ); $product = $this->add_classes_to_add_to_cart_form_input( $product, $attributes );
$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes );
$product_classname = $is_descendent_of_single_product_block ? 'product' : ''; $product_classname = $is_descendent_of_single_product_block ? 'product' : '';
$classes = implode( $classes = implode(

View File

@ -34,7 +34,7 @@ class Breadcrumbs extends AbstractBlock {
return; return;
} }
$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes ); $classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, array(), array( 'extra_classes' ) );
return sprintf( return sprintf(
'<div %1$s>%2$s</div>', '<div %1$s>%2$s</div>',

View File

@ -35,7 +35,7 @@ class CatalogSorting extends AbstractBlock {
return; return;
} }
$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes ); $classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, array(), array( 'extra_classes' ) );
$wrapper_attributes = get_block_wrapper_attributes( $wrapper_attributes = get_block_wrapper_attributes(
array( array(
'class' => implode( 'class' => implode(

View File

@ -90,7 +90,7 @@ class ProductAverageRating extends AbstractBlock {
return ''; return '';
} }
$styles_and_classes = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes ); $styles_and_classes = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, array(), array( 'extra_classes' ) );
$text_align_styles_and_classes = StyleAttributesUtils::get_text_align_class_and_style( $attributes ); $text_align_styles_and_classes = StyleAttributesUtils::get_text_align_class_and_style( $attributes );
$wrapper_attributes = get_block_wrapper_attributes( $wrapper_attributes = get_block_wrapper_attributes(

View File

@ -56,8 +56,7 @@ class ProductGalleryPager extends AbstractBlock {
} }
$number_of_thumbnails = $block->context['thumbnailsNumberOfThumbnails'] ?? 0; $number_of_thumbnails = $block->context['thumbnailsNumberOfThumbnails'] ?? 0;
$classname = StyleAttributesUtils::get_classes_by_attributes( $attributes, array( 'extra_classes' ) ); $wrapper_attributes = get_block_wrapper_attributes();
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => trim( $classname ) ) );
$post_id = $block->context['postId'] ?? ''; $post_id = $block->context['postId'] ?? '';
$product = wc_get_product( $post_id ); $product = wc_get_product( $post_id );

View File

@ -203,7 +203,7 @@ class ProductImage extends AbstractBlock {
} }
$parsed_attributes = $this->parse_attributes( $attributes ); $parsed_attributes = $this->parse_attributes( $attributes );
$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes ); $classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, array(), array( 'extra_classes' ) );
$post_id = isset( $block->context['postId'] ) ? $block->context['postId'] : ''; $post_id = isset( $block->context['postId'] ) ? $block->context['postId'] : '';
$product = wc_get_product( $post_id ); $product = wc_get_product( $post_id );

View File

@ -45,7 +45,7 @@ class StoreNotices extends AbstractBlock {
return; return;
} }
$classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes ); $classes_and_styles = StyleAttributesUtils::get_classes_and_styles_by_attributes( $attributes, array(), array( 'extra_classes' ) );
return sprintf( return sprintf(
'<div %1$s>%2$s</div>', '<div %1$s>%2$s</div>',