wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_get_state_text_clip_escape › WordPress Function

Seit7.2.0
Veraltetn/v
› wp_get_state_text_clip_escape ( $state_style, $base_clip )
Parameter: (2)
  • (array<string,mixed>) $state_style State style object.
    Erforderlich: Ja
  • (string) $base_clip Background clip of the styles the state layers over.
    Erforderlich: Ja
Gibt zurück:
  • (array<string,string>) CSS declarations, empty when no escape is needed.
Definiert in:
Codex:

Returns the declarations that unclip a text clip when a state sets a different clip.

Mirror of getStateTextClipEscapeCSS in packages/block-editor/src/hooks/style.jsx.


Quellcode

function wp_get_state_text_clip_escape( array $state_style, string $base_clip ): 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 ) || 'text' === $state_clip || 'text' !== $base_clip || wp_state_paints_own_background( $state_style ) ) {
		return array();
	}
	return array( 'background-image' => 'unset' );
}