Automattic\WooCommerce\Blocks\BlockTypes
FeaturedItem::get_classes
Get Featured-specific class names for the block container.
Метод класса: FeaturedItem{}
Хуков нет.
Возвращает
string.
Использование
$FeaturedItem = new FeaturedItem(); $FeaturedItem->get_classes( $attributes );
- $attributes(массив) (обязательный)
- Block attributes.
По умолчанию:empty array
Код FeaturedItem::get_classes() FeaturedItem::get classes WC 11.3.0
public function get_classes( $attributes ) {
$classes = array( 'wc-block-' . $this->block_name );
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 ( in_array( $attributes['verticalAlignment'] ?? '', array( 'top', 'center', 'bottom' ), true ) ) {
$classes[] = 'is-vertically-aligned-' . $attributes['verticalAlignment'];
}
return implode( ' ', $classes );
}