Automattic\WooCommerce\Blocks\Utils
StyleAttributesUtils::get_link_hover_color_class_and_style()
Get class and style for link-hover-color from attributes.
Метод класса: StyleAttributesUtils{}
Хуков нет.
Возвращает
Массив
.
Использование
$result = StyleAttributesUtils::get_link_hover_color_class_and_style( $attributes );
- $attributes(массив) (обязательный)
- Block attributes.
Код StyleAttributesUtils::get_link_hover_color_class_and_style() StyleAttributesUtils::get link hover color class and style WC 9.4.2
public static function get_link_hover_color_class_and_style( $attributes ) { $link_color = self::array_get_value_by_path( $attributes, 'style.elements.link.:hover.color.text' ); if ( empty( $link_color ) ) { return self::EMPTY_STYLE; } // If the link color is selected from the theme color picker, the value of $link_color is var:preset|color|slug. // If the link color is selected from the core color picker, the value of $link_color is an hex value. // When the link color is a string var:preset|color|slug we parsed it for get the slug, otherwise we use the hex value. if ( strstr( $link_color, '|' ) ) { $link_color_parts = explode( '|', $link_color ); $link_color = self::get_preset_value( end( $link_color_parts ) ); } return array( 'class' => 'has-link-color', 'style' => sprintf( 'color: %s;', $link_color ), 'value' => $link_color, ); }