Make WordPress Core

Changeset 54251

Timestamp:
09/20/2022 01:10:28 PM (23 months ago)
Author:
audrasjb
Message:

Editor: Backport hooks to filter theme.json data from Gutenberg to 6.1.

This changeset ports the work done in Gutenberg (released in 14.1) to add hooks to filter the theme.json data. Specifically, it adds the following filters: theme_json_default, theme_json_blocks, theme_json_theme, and theme_json_user.

For more details, see the following Gutenberg pull requests:

Props oandregal, czapla, gziolo, bernhard-reiter.
See #56467.

Location:
trunk/src
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json-resolver.php

    r54246 r54251  
    138138        $config       = static::read_json_file( __DIR__ . '/theme.json' );
    139139        $config       = static::translate( $config );
     140
     141
     142
     143
     144
     145
     146
     147
     148
    140149        static::$core = new WP_Theme_JSON( $config, 'default' );
    141150
     
    173182            $theme_json_data = static::read_json_file( static::get_file_path_from_theme( 'theme.json' ) );
    174183            $theme_json_data = static::translate( $theme_json_data, wp_get_theme()->get( 'TextDomain' ) );
     184
     185
     186
     187
     188
     189
     190
     191
     192
    175193            static::$theme   = new WP_Theme_JSON( $theme_json_data );
    176194
     
    258276            }
    259277        }
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
    260288
    261289        // Core here means it's the lower level part of the styles chain.
     
    383411            if ( JSON_ERROR_NONE !== $json_decoding_error ) {
    384412                trigger_error( 'Error when decoding a theme.json schema for user data. ' . json_last_error_msg() );
     413
     414
     415
     416
     417
     418
     419
     420
     421
    385422                return new WP_Theme_JSON( $config, 'custom' );
    386423            }
     
    397434            }
    398435        }
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
    399446        static::$user = new WP_Theme_JSON( $config, 'custom' );
    400447
  • trunk/src/wp-settings.php

    r54156 r54251  
    173173require ABSPATH . WPINC . '/class-wp-theme.php';
    174174require ABSPATH . WPINC . '/class-wp-theme-json-schema.php';
     175
    175176require ABSPATH . WPINC . '/class-wp-theme-json.php';
    176177require ABSPATH . WPINC . '/class-wp-theme-json-resolver.php';
Note: See TracChangeset for help on using the changeset viewer.