WP_Style_Engine_CSS_Rule::add_declarations() – Sets the declarations.

You appear to be a bot. Output may be restricted

Description

Sets the declarations.

Usage

$WP_Style_Engine_CSS_Rule = WP_Style_Engine_CSS_Rule::add_declarations( $declarations );

Parameters

$declarations
( array|WP_Style_Engine_CSS_Declarations ) required – An array of declarations (property => value pairs), or a WP_Style_Engine_CSS_Declarations object.

Returns

WP_Style_Engine_CSS_Rule Returns the object to allow chaining of methods.

Source

File name: wordpress/wp-includes/style-engine/class-wp-style-engine-css-rule.php


Lines:

1 to 16 of 16
  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;
  }
 

 View on GitHub View on Trac