WP_Style_Engine_CSS_Declarations::add_declaration()publicWP 6.1.0

Adds a single declaration.

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

No Hooks.

Return

WP_Style_Engine_CSS_Declarations. Returns the object to allow chaining methods.

Usage

$WP_Style_Engine_CSS_Declarations = new WP_Style_Engine_CSS_Declarations();
$WP_Style_Engine_CSS_Declarations->add_declaration( $property, $value );
$property(string) (required)
The CSS property.
$value(string) (required)
The CSS value.

Changelog

Since 6.1.0 Introduced.

Code of WP_Style_Engine_CSS_Declarations::add_declaration() WP 6.1.1

public function add_declaration( $property, $value ) {
	// Sanitizes the property.
	$property = $this->sanitize_property( $property );
	// Bails early if the property is empty.
	if ( empty( $property ) ) {
		return $this;
	}

	// Trims the value. If empty, bail early.
	$value = trim( $value );
	if ( '' === $value ) {
		return $this;
	}

	// Adds the declaration property/value pair.
	$this->declarations[ $property ] = $value;

	return $this;
}