wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_get_state_text_fill_reset › WordPress Function

Since7.2.0
Deprecatedn/a
› wp_get_state_text_fill_reset ( $state_style )
Parameters:
  • (array<string,mixed>) $state_style State style object.
    Required: Yes
Returns:
  • (array<string,string>) CSS declarations, empty when no reset is needed.
Defined at:
Codex:

Returns the declarations that refill the letters when a state sets a text color but no clip.

The fill is added even without a known text clip, since a block instance cannot see a clip set in global styles. It does nothing when no clip applies. Mirror of getStateTextFillResetCSS in packages/block-editor/src/hooks/style.jsx.


Source

function wp_get_state_text_fill_reset( array $state_style ): array {
	$state_clip = $state_style['background']['backgroundClip'] ?? '';
	if ( ! in_array( $state_clip, WP_Style_Engine::VALID_BACKGROUND_CLIP_VALUES, true ) ) {
		$state_clip = '';
	}
	if ( ! empty( $state_clip ) || empty( $state_style['color']['text'] ) || wp_state_paints_own_background( $state_style ) ) {
		return array();
	}
	return array( '-webkit-text-fill-color' => 'currentColor' );
}