WP_Style_Engine_Processor::add_rules( WP_Style_Engine_CSS_Rule|WP_Style_Engine_CSS_Rule[] $css_rules ): WP_Style_Engine_Processor

In this article

Adds rules to be processed.

Parameters

$css_rulesWP_Style_Engine_CSS_Rule|WP_Style_Engine_CSS_Rule[]required
A single, or an array of, WP_Style_Engine_CSS_Rule objects from a store or otherwise.

Return

WP_Style_Engine_Processor Returns the object to allow chaining methods.

Source

public function add_rules( $css_rules ) {
	if ( ! is_array( $css_rules ) ) {
		$css_rules = array( $css_rules );
	}

	foreach ( $css_rules as $rule ) {
		$selector = $rule->get_selector();
		if ( isset( $this->css_rules[ $selector ] ) ) {
			$this->css_rules[ $selector ]->add_declarations( $rule->get_declarations() );
			continue;
		}
		$this->css_rules[ $rule->get_selector() ] = $rule;
	}

	return $this;
}

Changelog

VersionDescription
6.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.