WooCommerce Code Reference

Social_Links_Helper
in package

This class should provide helper functions for the Social Links block.

Table of Contents

detect_whiteish_color()  : bool
Detects if the input color is whiteish.
get_default_social_link_size()  : string
Gets the default social link size.
get_service_brand_color()  : string
Gets the brand color for a given service.
get_social_link_size_option_value()  : string
Gets the size option value for a given size.

Methods

detect_whiteish_color()

Detects if the input color is whiteish.

public static detect_whiteish_color(string $input_color) : bool

This is a helper function to detect if the input color is white or white-ish colors when provided an input color in format #ffffff or #fff.

Parameters
$input_color : string

The input color.

Return values
boolTrue if the color is whiteish, false otherwise.

get_service_brand_color()

Gets the brand color for a given service.

public static get_service_brand_color(string $service_name) : string

From core: https://github.com/WordPress/gutenberg/blob/edbd36057d3d25b7140af9e90a2adcca02a9201c/packages/block-library/src/social-link/socials-without-bg.scss

Parameters
$service_name : string

The name of the service.

Return values
stringThe brand color for the service.

Gets the size option value for a given size.

public static get_social_link_size_option_value(string $size) : string

Source: https://github.com/WordPress/gutenberg/blob/c7c09cfe16c78f9a949956e5d0088cd4c747bdca/packages/block-library/src/social-links/style.scss#L36-L56

Parameters
$size : string

The size.

Return values
stringThe size option value.