WP_Style_Engine_Processor::add_rules()publicWP 6.1.0

Adds rules to be processed.

{} Это метод класса: WP_Style_Engine_Processor{}

Хуков нет.

Возвращает

WP_Style_Engine_Processor. Returns the object to allow chaining methods.

Использование

$WP_Style_Engine_Processor = new WP_Style_Engine_Processor();
$WP_Style_Engine_Processor->add_rules( $css_rules );
$css_rules(WP_Style_Engine_CSS_Rule|WP_Style_Engine_CSS_Rule[]) (обязательный)
A single, or an array of, WP_Style_Engine_CSS_Rule objects from a store or otherwise.

Список изменений

С версии 6.1.0 Введена.

Код WP_Style_Engine_Processor::add_rules() WP 6.1.1

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;
}