add_declarations example


    public function __construct( $declarations = array() ) {
        $this->add_declarations( $declarations );
    }

    /** * Adds a single declaration. * * @since 6.1.0 * * @param string $property The CSS property. * @param string $value The CSS value. * @return WP_Style_Engine_CSS_Declarations Returns the object to allow chaining methods. */
    

    public static function store_css_rule( $store_name$css_selector$css_declarations ) {
        if ( empty( $store_name ) || empty( $css_selector ) || empty( $css_declarations ) ) {
            return;
        }
        static::get_store( $store_name )->add_rule( $css_selector )->add_declarations( $css_declarations );
    }

    /** * Returns a store by store key. * * @since 6.1.0 * * @param string $store_name A store key. * @return WP_Style_Engine_CSS_Rules_Store|null */
    public static function get_store( $store_name ) {
        

    public function __construct( $selector = '', $declarations = array() ) {
        $this->set_selector( $selector );
        $this->add_declarations( $declarations );
    }

    /** * Sets the selector. * * @since 6.1.0 * * @param string $selector The CSS selector. * @return WP_Style_Engine_CSS_Rule Returns the object to allow chaining of methods. */
    public function set_selector( $selector ) {
        

    public function add_rules( $css_rules ) {
        if ( ! is_array( $css_rules ) ) {
            $css_rules = array( $css_rules );
        }

        foreach ( $css_rules as $rule ) {
            $selector = $rule->get_selector();
            if ( isset( $this->css_rules[ $selector ] ) ) {
                $this->css_rules[ $selector ]->add_declarations( $rule->get_declarations() );
                continue;
            }
            $this->css_rules[ $rule->get_selector() ] = $rule;
        }

        return $this;
    }

    /** * Gets the CSS rules as a string. * * @since 6.1.0 * * @param array $options { * Optional. An array of options. Default empty array. * * @type bool $optimize Whether to optimize the CSS output, e.g. combine rules. * Default true. * @type bool $prettify Whether to add new lines and indents to output. * Defaults to whether the `SCRIPT_DEBUG` constant is defined. * } * @return string The computed CSS. */
Home | Imprint | This part of the site doesn't use cookies.