resolve_variables example

$origin = 'custom';
    if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) {
        $origin = 'theme';
    }

    $resolve_variables = isset( $context['transforms'] )
    && is_array( $context['transforms'] )
    && in_array( 'resolve-variables', $context['transforms'], true );

    $merged_data = WP_Theme_JSON_Resolver::get_merged_data( $origin );
    if ( $resolve_variables ) {
        $merged_data = WP_Theme_JSON::resolve_variables( $merged_data );
    }
    $styles = $merged_data->get_raw_data()['styles'];
    return _wp_array_get( $styles$path$styles );
}


/** * Returns the stylesheet resulting of merging core, theme, and user data. * * @since 5.9.0 * @since 6.1.0 Added 'base-layout-styles' support. * * @param array $types Optional. Types of styles to load. * It accepts as values 'variables', 'presets', 'styles', 'base-layout-styles'. * If empty, it'll load the following: * - for themes without theme.json: 'variables', 'presets', 'base-layout-styles'. * - for themes with theme.json: 'variables', 'presets', 'styles'. * @return string Stylesheet. */
Home | Imprint | This part of the site doesn't use cookies.