Make WordPress Core


Ignore:
Timestamp:
10/04/2023 07:08:55 PM (3 years ago)
Author:
audrasjb
Message:

Editor: Preserve block style variations when securing theme.

Adds the ability to process block style variations to the remove_insecure_properties function of theme json class.

Props dsas, ramonopoly, dean, isabel_brison, joemcgill, audrasjb.
Merges [56502] and [56778] to the 6.3 branch.
Fixes #59108.

Location:
branches/6.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.3

  • branches/6.3/src/wp-includes/class-wp-theme-json.php

    r56181 r56779  
    28502850         *
    28512851         * @since 5.9.0
     2852         * @since 6.3.2 Preserves global styles block variations when securing styles.
    28522853         *
    28532854         * @param array $theme_json Structure to sanitize.
    … …  
    29102911                        if ( ! empty( $output ) ) {
    29112912                                _wp_array_set( $sanitized, $metadata['path'], $output );
     2913                        }
     2914
     2915                        if ( isset( $metadata['variations'] ) ) {
     2916                                foreach ( $metadata['variations'] as $variation ) {
     2917                                        $variation_input = _wp_array_get( $theme_json, $variation['path'], array() );
     2918                                        if ( empty( $variation_input ) ) {
     2919                                                continue;
     2920                                        }
     2921
     2922                                        $variation_output = static::remove_insecure_styles( $variation_input );
     2923                                        if ( ! empty( $variation_output ) ) {
     2924                                                _wp_array_set( $sanitized, $variation['path'], $variation_output );
     2925                                        }
     2926                                }
    29122927                        }
    29132928                }
Note: See TracChangeset for help on using the changeset viewer.