WP_Style_Engine_CSS_Declarations::add_declaration()publicWP 6.1.0

Adds a single declaration.

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

Хуков нет.

Возвращает

WP_Style_Engine_CSS_Declarations. Returns the object to allow chaining methods.

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

$WP_Style_Engine_CSS_Declarations = new WP_Style_Engine_CSS_Declarations();
$WP_Style_Engine_CSS_Declarations->add_declaration( $property, $value );
$property(строка) (обязательный)
The CSS property.
$value(строка) (обязательный)
The CSS value.

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

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

Код WP_Style_Engine_CSS_Declarations::add_declaration() WP 6.5.2

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