Automattic\WooCommerce\Blocks\Utils
StyleAttributesUtils::get_text_color_class_and_style
Get class and style for text-color from attributes.
Метод класса: StyleAttributesUtils{}
Хуков нет.
Возвращает
array.
Использование
$result = StyleAttributesUtils::get_text_color_class_and_style( $attributes );
- $attributes(массив) (обязательный)
- Block attributes.
Код StyleAttributesUtils::get_text_color_class_and_style() StyleAttributesUtils::get text color class and style WC 11.3.0
public static function get_text_color_class_and_style( $attributes ) {
$text_color = $attributes['textColor'] ?? '';
$custom_text_color = $attributes['style']['color']['text'] ?? '';
if ( $text_color ) {
return array(
'class' => sprintf( 'has-text-color has-%s-color', $text_color ),
'style' => null,
'value' => self::get_preset_value( $text_color ),
);
}
if ( $custom_text_color ) {
return array(
'class' => null,
'style' => sprintf( 'color: %s;', $custom_text_color ),
'value' => $custom_text_color,
);
}
return self::EMPTY_STYLE;
}