Util

General utilities.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

add_inline_script_params()  : mixed
Helper function to replace wp_localize_script
get_allowed_product_types()  : array<string|int, mixed>
Returns the allowed product types.
get_attribute_taxonomies()  : mixed
get_field_class()  : string|false
Retrieve the Field class for an option type.
get_html_attribute_string()  : string
Generates a HTML attributes string for an array of data.
get_inventory_properties()  : mixed
get_shipping_properties()  : mixed
groups_have_options()  : bool
Determines if a group has options.
is_allowed_product_type()  : bool
Checks if a product type is allowed.
is_color_bright()  : bool
Determine if a color is bright.

Methods

add_inline_script_params()

Helper function to replace wp_localize_script

public static add_inline_script_params(string $script_handle, string $variable_name, array<string|int, mixed> $script_params) : mixed
Parameters
$script_handle : string
$variable_name : string
$script_params : array<string|int, mixed>
Tags
Return values
mixed

get_allowed_product_types()

Returns the allowed product types.

public static get_allowed_product_types() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_attribute_taxonomies()

public static get_attribute_taxonomies() : mixed
Tags
Return values
mixed

get_field_class()

Retrieve the Field class for an option type.

public static get_field_class(string $type) : string|false
Parameters
$type : string
Tags
Return values
string|false

get_html_attribute_string()

Generates a HTML attributes string for an array of data.

public static get_html_attribute_string(array<string|int, mixed> $attributes) : string
Parameters
$attributes : array<string|int, mixed>
Tags
Return values
string

$attribute_string

get_inventory_properties()

public static get_inventory_properties() : mixed
Tags
Return values
mixed

get_shipping_properties()

public static get_shipping_properties() : mixed
Tags
Return values
mixed

groups_have_options()

Determines if a group has options.

public static groups_have_options(mixed $groups) : bool
Parameters
$groups : mixed
Tags
Return values
bool

is_allowed_product_type()

Checks if a product type is allowed.

public static is_allowed_product_type(string $type) : bool
Parameters
$type : string
Tags
Return values
bool

is_color_bright()

Determine if a color is bright.

public static is_color_bright(string $hex_color[, int $threshold = 240 ]) : bool
Parameters
$hex_color : string

Hexadecimal color value without the '#' e.g. 'E6E6E6'

$threshold : int = 240
Tags
Return values
bool

Search results