Automattic\WooCommerce\Blocks\Utils
StyleAttributesUtils::get_align_class_and_style
Get class and style for align from attributes.
Метод класса: StyleAttributesUtils{}
Хуков нет.
Возвращает
Массив.
Использование
$result = StyleAttributesUtils::get_align_class_and_style( $attributes );
- $attributes(массив) (обязательный)
- Block attributes.
Код StyleAttributesUtils::get_align_class_and_style() StyleAttributesUtils::get align class and style WC 10.5.0
public static function get_align_class_and_style( $attributes ) {
$align_attribute = $attributes['align'] ?? null;
if ( 'wide' === $align_attribute ) {
return array(
'class' => 'alignwide',
'style' => null,
);
}
if ( 'full' === $align_attribute ) {
return array(
'class' => 'alignfull',
'style' => null,
);
}
if ( 'left' === $align_attribute ) {
return array(
'class' => 'alignleft',
'style' => null,
);
}
if ( 'right' === $align_attribute ) {
return array(
'class' => 'alignright',
'style' => null,
);
}
if ( 'center' === $align_attribute ) {
return array(
'class' => 'aligncenter',
'style' => null,
);
}
return self::EMPTY_STYLE;
}