WP_Style_Engine_CSS_Rule::add_declarations()publicWP 6.1.0

Sets the declarations.

Метод класса: WP_Style_Engine_CSS_Rule{}

Хуков нет.

Возвращает

WP_Style_Engine_CSS_Rule. Returns the object to allow chaining of methods.

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

$WP_Style_Engine_CSS_Rule = new WP_Style_Engine_CSS_Rule();
$WP_Style_Engine_CSS_Rule->add_declarations( $declarations );
$declarations(массив|WP_Style_Engine_CSS_Declarations) (обязательный)
An array of declarations (property => value pairs), or a WP_Style_Engine_CSS_Declarations object.

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

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

Код WP_Style_Engine_CSS_Rule::add_declarations() WP 6.1.1

public function add_declarations( $declarations ) {
	$is_declarations_object = ! is_array( $declarations );
	$declarations_array     = $is_declarations_object ? $declarations->get_declarations() : $declarations;

	if ( null === $this->declarations ) {
		if ( $is_declarations_object ) {
			$this->declarations = $declarations;
			return $this;
		}
		$this->declarations = new WP_Style_Engine_CSS_Declarations( $declarations_array );
	}
	$this->declarations->add_declarations( $declarations_array );

	return $this;
}