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



wp_add_block_state_style_rule › WordPress Function

Seit7.1.0
Veraltetn/v
wp_add_block_state_style_rule ( $css_rules, $state, $selector, $style, $rules_group = null )
Parameter: (5)
  • (array) $css_rules Style rules.
    Erforderlich: Ja
  • (string) $state Pseudo-state selector.
    Erforderlich: Ja
  • (string|null) $selector Block, feature, or element selector.
    Erforderlich: Ja
  • (array) $style Style object.
    Erforderlich: Ja
  • (string|null) $rules_group Optional CSS grouping rule, e.g. a media query.
    Erforderlich: Nein
    Standard: null
Definiert in:
Codex:

Adds a compiled state style rule to a rule list.



Quellcode

function wp_add_block_state_style_rule( &$css_rules, $state, $selector, $style, $rules_group = null ) {
	if ( empty( $style ) || ! is_array( $style ) ) {
		return;
	}

	$compiled = wp_style_engine_get_styles(
		wp_normalize_state_style_for_css_output( $style )
	);

	if ( empty( $compiled['declarations'] ) ) {
		return;
	}

	$css_rules[] = array(
		'state'        => $state,
		'selector'     => $selector,
		'declarations' => $compiled['declarations'],
	);
	if ( ! empty( $rules_group ) ) {
		$css_rules[ count( $css_rules ) - 1 ]['rules_group'] = $rules_group;
	}
}