WPDev.one
Core Class

WP_Duotone

class WP_Duotone // Constructor: function Object() { [native code] }

Manages duotone block supports and global styles.

Methods 38 methods

Method / Return Description
colord_clamp()
float

Clamps a value between an upper and lower bound.

Parameters: $number: mixed, $min: mixed, $max: mixed
colord_clamp_hue()
float

Processes and clamps a degree (angle) value properly.

Parameters: $degrees: mixed
colord_parse_hue()
float

Converts a hue value to degrees from 0 to 360 inclusive.

Parameters: $value: mixed, $unit: mixed
colord_parse_hex()
(array

Parses any valid Hex3, Hex4, Hex6 or Hex8 string and converts it to an RGBA object.

Parameters: $hex: mixed
colord_clamp_rgba()
array

Clamps an array of RGBA values.

Parameters: $rgba: mixed
colord_parse_rgba_string()
(array

Parses a valid RGB[A] CSS color function/string.

Parameters: $input: mixed
colord_clamp_hsla()
array

Clamps an array of HSLA values.

Parameters: $hsla: mixed
colord_hsva_to_rgba()
array

Converts an HSVA array to RGBA.

Parameters: $hsva: mixed
colord_hsla_to_hsva()
array

Converts an HSLA array to HSVA.

Parameters: $hsla: mixed
colord_hsla_to_rgba()
array

Converts an HSLA array to RGBA.

Parameters: $hsla: mixed
colord_parse_hsla_string()
(array

Parses a valid HSL[A] CSS color function/string.

Parameters: $input: mixed
colord_parse()
(array

Tries to convert an incoming string into RGBA values.

Parameters: $input: mixed
get_slug_from_attribute()
string

Takes the inline CSS duotone variable from a block and return the slug.

Parameters: $duotone_attr: mixed
is_preset()
bool

Checks if we have a valid duotone preset.

Parameters: $duotone_attr: mixed
get_css_custom_property_name()
string

Gets the CSS variable name for a duotone preset.

Parameters: $slug: mixed
get_filter_id()
string

Get the ID of the duotone filter.

Parameters: $slug: mixed
get_css_var()
string

Get the CSS variable for a duotone preset.

Parameters: $slug: mixed
get_filter_url()
string

Get the URL for a duotone filter.

Parameters: $filter_id: mixed
get_filter_svg()
string

Gets the SVG for the duotone filter definition.

Parameters: $filter_id: mixed, $colors: mixed
get_filter_id_from_preset()
string

Returns the prefixed id for the duotone filter for use as a CSS id.

Parameters: $preset: mixed
get_filter_svg_from_preset()
string

Gets the SVG for the duotone filter definition from a preset.

Parameters: $preset: mixed
get_svg_definitions()
string

Get the SVGs for the duotone filters.

Parameters: $sources: mixed
get_global_styles_presets()
string

Get the CSS for global styles.

Parameters: $sources: mixed
enqueue_block_css()
void

Enqueue a block CSS declaration for the page.

Parameters: $filter_id: mixed, $duotone_selector: mixed, $filter_value: mixed
enqueue_custom_filter()
void

Enqueue custom filter assets for the page.

Parameters: $filter_id: mixed, $duotone_selector: mixed, $filter_value: mixed, $filter_data: mixed
enqueue_global_styles_preset()
void

Enqueue preset assets for the page.

Parameters: $filter_id: mixed, $duotone_selector: mixed, $filter_value: mixed
register_duotone_support()
void

Registers the style and colors block attributes for block types that support it.

Parameters: $block_type: mixed
get_selector()
(string

Get the CSS selector for a block type.

Parameters: $block_type: mixed
get_all_global_styles_presets()
array

Scrape all possible duotone presets from global and theme styles and

get_all_global_style_block_names()
string[]

Scrape all block names from global styles and store in self::$global_styles_block_names.

render_duotone_support()
string

Render out the duotone CSS styles and SVG.

Parameters: $block_content: mixed, $block: mixed, $wp_block: mixed
restore_image_outer_container()
string

Fixes the issue with our generated class name not being added to the block's outer container

Parameters: $block_content: mixed
output_block_styles()
void

Appends the used block duotone filter declarations to the inline block supports CSS.

output_global_styles()
void

Appends the used global style duotone filter presets (CSS custom

output_footer_assets()
void

Outputs all necessary SVG for duotone filters, CSS for classic themes.

add_editor_settings()
array

Adds the duotone SVGs and CSS custom properties to the editor settings.

Parameters: $settings: mixed
migrate_experimental_duotone_support_flag()
array

Migrates the experimental duotone support flag to the stabilized location.

Parameters: $settings: mixed, $metadata: mixed
get_filter_css_property_value_from_preset()
string

Gets the CSS filter property value from a preset.

Parameters: $preset: mixed

Properties

Property / Type Description
$global_styles_block_names
mixed
public
No description available.
$global_styles_presets
mixed
public
No description available.
$used_global_styles_presets
mixed
public
No description available.
$used_svg_filter_data
mixed
public
No description available.
$block_css_declarations
mixed
public
No description available.

Class Information

Source File
wp-includes/class-wp-duotone.php
Advertisement