Automattic\WooCommerce\Blocks\BlockTypes
FeaturedItem::get_classes
Get class names for the block container.
Method of the class: FeaturedItem{}
No Hooks.
Returns
String.
Usage
$FeaturedItem = new FeaturedItem(); $FeaturedItem->get_classes( $attributes );
- $attributes(array) (required)
- Block attributes.
Default: empty array
FeaturedItem::get_classes() FeaturedItem::get classes code WC 10.3.3
public function get_classes( $attributes ) {
$classes = array( 'wc-block-' . $this->block_name );
if ( isset( $attributes['align'] ) ) {
$classes[] = "align{$attributes['align']}";
}
if ( isset( $attributes['dimRatio'] ) && ( 0 !== $attributes['dimRatio'] ) ) {
$classes[] = 'has-background-dim';
if ( 50 !== $attributes['dimRatio'] ) {
$classes[] = 'has-background-dim-' . 10 * round( $attributes['dimRatio'] / 10 );
}
}
if ( isset( $attributes['contentAlign'] ) && 'center' !== $attributes['contentAlign'] ) {
$classes[] = "has-{$attributes['contentAlign']}-content";
}
$global_style_classes = StyleAttributesUtils::get_classes_by_attributes( $attributes, $this->global_style_wrapper );
$classes[] = $global_style_classes;
return implode( ' ', $classes );
}