Automattic\WooCommerce\Blocks\BlockTypes

FeaturedItem::get_classes()publicWC 1.0

Get class names for the block container.

{} Это метод класса: FeaturedItem{}

Хуков нет.

Возвращает

Строку.

Использование

$FeaturedItem = new FeaturedItem();
$FeaturedItem->get_classes( $attributes );
$attributes(массив) (обязательный)
Block attributes.
По умолчанию: empty array

Код FeaturedItem::get_classes() WC 6.7.0

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";
	}

	if ( isset( $attributes['className'] ) ) {
		$classes[] = $attributes['className'];
	}

	$global_style_classes = StyleAttributesUtils::get_classes_by_attributes( $attributes, $this->global_style_wrapper );

	$classes[] = $global_style_classes;

	return implode( ' ', $classes );
}