WP_Style_Engine_CSS_Rule::add_declarations( string[]|WP_Style_Engine_CSS_Declarations $declarations ): WP_Style_Engine_CSS_Rule

In this article

Sets the declarations.

Parameters

$declarationsstring[]|WP_Style_Engine_CSS_Declarationsrequired
An array of declarations (property => value pairs), or a WP_Style_Engine_CSS_Declarations object.

Return

WP_Style_Engine_CSS_Rule Returns the object to allow chaining of methods.

Source

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

Changelog

VersionDescription
6.1.0Introduced.

User Contributed Notes

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