mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-07 06:05:42 +00:00
Editor: Add missing blocks origin to theme.json.
This changeset updates the blocks origin name from core to blocks and adds it to the list of valid origins for `theme.json`. (See the original fix in [https://github.com//pull/3319 Gutenberg's PR 44363]). Why? - This new origin was missing from the list. - The `core` name is not reflective of what it does, as this data origin is related to block styles, whether they come with WordPress or third-party blocks. - The existing filter for this piece of data is called `theme_json_blocks`, to reflect it filters "block" data. - Though `core` origin was used in the past for `default`, this commit reverts it. Why? It was confusing. The goal is to use names that communicate what part of the pipeline are processing (`default > blocks > theme > custom`). How? - Renames the string, from `core` to `blocks`. - Adds `blocks` to the list of valid origins. - Verifies that the `$theme_json->get_stylesheet()` call uses the proper `$origins` at all times. Follow-up to [54162], [54251]. Props oandregal, czapla, jorgefilipecosta, scruffian, bernhard-reiter hellofromTonya. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54408 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2409,14 +2409,11 @@ function wp_enqueue_global_styles() {
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are loading CSS for each block separately, then we can load the theme.json CSS conditionally.
|
||||
* If loading the CSS for each block separately, then load the theme.json CSS conditionally.
|
||||
* This removes the CSS from the global-styles stylesheet and adds it to the inline CSS for each block.
|
||||
* This filter must be registered before calling wp_get_global_stylesheet();
|
||||
*/
|
||||
if ( $separate_assets ) {
|
||||
add_filter( 'theme_json_get_style_nodes', 'wp_filter_out_block_nodes' );
|
||||
// Add each block as an inline css.
|
||||
wp_add_global_styles_for_blocks();
|
||||
}
|
||||
add_filter( 'theme_json_get_style_nodes', 'wp_filter_out_block_nodes' );
|
||||
|
||||
$stylesheet = wp_get_global_stylesheet();
|
||||
|
||||
@@ -2427,6 +2424,9 @@ function wp_enqueue_global_styles() {
|
||||
wp_register_style( 'global-styles', false, array(), true, true );
|
||||
wp_add_inline_style( 'global-styles', $stylesheet );
|
||||
wp_enqueue_style( 'global-styles' );
|
||||
|
||||
// Add each block as an inline css.
|
||||
wp_add_global_styles_for_blocks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user