compute_theme_vars example

protected function get_css_variables( $nodes$origins ) {
        $stylesheet = '';
        foreach ( $nodes as $metadata ) {
            if ( null === $metadata['selector'] ) {
                continue;
            }

            $selector = $metadata['selector'];

            $node                    = _wp_array_get( $this->theme_json, $metadata['path'], array() );
            $declarations            = static::compute_preset_vars( $node$origins );
            $theme_vars_declarations = static::compute_theme_vars( $node );
            foreach ( $theme_vars_declarations as $theme_vars_declaration ) {
                $declarations[] = $theme_vars_declaration;
            }

            $stylesheet .= static::to_ruleset( $selector$declarations );
        }

        return $stylesheet;
    }

    /** * Given a selector and a declaration list, * creates the corresponding ruleset. * * @since 5.8.0 * * @param string $selector CSS selector. * @param array $declarations List of declarations. * @return string The resulting CSS ruleset. */
Home | Imprint | This part of the site doesn't use cookies.