Automattic\WooCommerce\Blocks\Utils

StyleAttributesUtils::get_text_align_class_and_stylepublic staticWC 1.0

Get class and style for text align from attributes.

Метод класса: StyleAttributesUtils{}

Хуков нет.

Возвращает

Массив.

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

$result = StyleAttributesUtils::get_text_align_class_and_style( $attributes );
$attributes(массив) (обязательный)
Block attributes.

Код StyleAttributesUtils::get_text_align_class_and_style() WC 10.3.6

public static function get_text_align_class_and_style( $attributes ) {
	// Check if the text align is set in the attributes manually (legacy) or in the global styles.
	$text_align = $attributes['textAlign'] ?? $attributes['style']['typography']['textAlign'] ?? null;

	if ( $text_align ) {
		return array(
			'class' => 'has-text-align-' . $text_align,
			'style' => null,
		);
	}
	return self::EMPTY_STYLE;
}