Jetpack_Custom_CSS_Enhancements::update_custom_css_data PHP Method

update_custom_css_data() public static method

Filter to handle the processing of preprocessed css on save.
public static update_custom_css_data ( array $args, string $stylesheet ) : mixed
$args array Custom CSS options.
$stylesheet string Original CSS to be updated.
return mixed
    public static function update_custom_css_data($args, $stylesheet)
    {
        // Find the current preprocessor.
        $jetpack_custom_css = get_theme_mod('jetpack_custom_css', array());
        if (empty($jetpack_custom_css['preprocessor'])) {
            return $args;
        }
        /** This filter is documented in modules/custom-css/custom-css.php */
        $preprocessors = apply_filters('jetpack_custom_css_preprocessors', array());
        $preprocessor = $jetpack_custom_css['preprocessor'];
        // If we have a preprocessor specified ...
        if (isset($preprocessors[$preprocessor])) {
            // And no other preprocessor has run ...
            if (empty($args['preprocessed'])) {
                $args['preprocessed'] = $args['css'];
                $args['css'] = call_user_func($preprocessors[$preprocessor]['callback'], $args['css']);
            } else {
                trigger_error('Jetpack CSS Preprocessor specified, but something else has already modified the argument.', E_USER_WARNING);
            }
        }
        return $args;
    }