parse_block_styles example


function wp_style_engine_get_styles( $block_styles$options = array() ) {
    $options = wp_parse_args(
        $options,
        array(
            'selector'                   => null,
            'context'                    => null,
            'convert_vars_to_classnames' => false,
        )
    );

    $parsed_styles = WP_Style_Engine::parse_block_styles( $block_styles$options );

    // Output.     $styles_output = array();

    if ( ! empty( $parsed_styles['declarations'] ) ) {
        $styles_output['css']          = WP_Style_Engine::compile_css( $parsed_styles['declarations']$options['selector'] );
        $styles_output['declarations'] = $parsed_styles['declarations'];
        if ( ! empty( $options['context'] ) ) {
            WP_Style_Engine::store_css_rule( $options['context']$options['selector']$parsed_styles['declarations'] );
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.