Site Editor: Implement a settings object filter #33737
Conversation
The post editor has the block_editor_settings_all and block_editor_settings filter that allows us to modify the settings object injected into the block editor. A similar filter, however, doesn't exist for the site editor. We apply the same filter here for the site editor.
Left a comment about needing another param and Core's filter documentation convention. Otherwise, this is great, and good call on not needing to call |
We need to add a second param to our call to apply filters because it is included in Core WordPress.
@@ -101,7 +101,10 @@ function gutenberg_edit_site_init( $hook ) { | |||
'__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(), | |||
) | |||
); | |||
$settings = gutenberg_experimental_global_styles_settings( $settings ); | |||
|
|||
$site_editor_context = new WP_Block_Editor_Context(); |
gziolo
Jul 30, 2021
Member
I'm not quite sure why the edit site page doesn't integrate this filter like other screens. If we decide to change it, we should refactor the code to use gutenberg_get_block_editor_settings
to handle it all behind the scenes rather that duplicating a similar logic.
I'm not quite sure why the edit site page doesn't integrate this filter like other screens. If we decide to change it, we should refactor the code to use gutenberg_get_block_editor_settings
to handle it all behind the scenes rather that duplicating a similar logic.
jeyip
Jul 30, 2021
Author
Contributor
Makes sense to me. I'll make the changes. 👍
Makes sense to me. I'll make the changes.
@@ -89,19 +89,17 @@ function gutenberg_edit_site_init( $hook ) { | |||
*/ | |||
$current_screen->is_block_editor( true ); | |||
|
|||
$settings = array_merge( | |||
gutenberg_get_default_block_editor_settings(), |
jeyip
Jul 30, 2021
•
Author
Contributor
gutenberg_get_default_block_editor_settings
will be merged in the gutenberg_get_block_editor_settings
function, which is why we remove it from here.
gutenberg/lib/compat/wordpress-5.8/block-editor.php
Lines 264 to 272
in
c96feeb
gutenberg_get_default_block_editor_settings
will be merged in the gutenberg_get_block_editor_settings
function, which is why we remove it from here.
gutenberg/lib/compat/wordpress-5.8/block-editor.php
Lines 264 to 272 in c96feeb
jeyip commentedJul 28, 2021
•
edited
Potentially solves #33736
Description
The post editor has the
block_editor_settings_all
andblock_editor_settings
filter that allows us to modify thesettings
object injected into the block editor. A similar filter, however, doesn't exist for the site editor.How has this been tested?
There should be no visible changes to the UI.
Screenshots
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).