Skip to content

Commit

Permalink
Move WP 5.9 wp-admin menus compatibility code to lib/compat folder (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored and noisysocks committed Dec 13, 2021
1 parent fdfffa4 commit 586f999
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Full Site Editing Utils
* WP Admin Menus changes to match WordPress 5.9
*
* @package gutenberg
*/
Expand Down Expand Up @@ -80,16 +80,3 @@ function gutenberg_site_requires_customizer() {

return false;
}

/**
* Tells the script loader to load the scripts and styles of custom block on site editor screen.
*
* @param bool $is_block_editor_screen Current decision about loading block assets.
* @return bool Filtered decision about loading block assets.
*/
function gutenberg_site_editor_load_block_editor_scripts_and_styles( $is_block_editor_screen ) {
return ( is_callable( 'get_current_screen' ) && get_current_screen() && 'appearance_page_gutenberg-edit-site' === get_current_screen()->base )
? true
: $is_block_editor_screen;
}
add_filter( 'should_load_block_editor_scripts_and_styles', 'gutenberg_site_editor_load_block_editor_scripts_and_styles' );
13 changes: 13 additions & 0 deletions lib/full-site-editing/edit-site-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,16 @@ function gutenberg_set_site_editor_list_page_title() {
}
}
add_action( 'load-appearance_page_gutenberg-edit-site', 'gutenberg_set_site_editor_list_page_title' );

/**
* Tells the script loader to load the scripts and styles of custom block on site editor screen.
*
* @param bool $is_block_editor_screen Current decision about loading block assets.
* @return bool Filtered decision about loading block assets.
*/
function gutenberg_site_editor_load_block_editor_scripts_and_styles( $is_block_editor_screen ) {
return ( is_callable( 'get_current_screen' ) && get_current_screen() && 'appearance_page_gutenberg-edit-site' === get_current_screen()->base )
? true
: $is_block_editor_screen;
}
add_filter( 'should_load_block_editor_scripts_and_styles', 'gutenberg_site_editor_load_block_editor_scripts_and_styles' );
2 changes: 1 addition & 1 deletion lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php';
require __DIR__ . '/compat/wordpress-5.9/class-wp-theme-json-resolver-gutenberg.php';
require __DIR__ . '/compat/wordpress-5.9/theme.php';
require __DIR__ . '/full-site-editing/full-site-editing.php';
require __DIR__ . '/compat/wordpress-5.9/admin-menu.php';
require __DIR__ . '/full-site-editing/edit-site-page.php';
require __DIR__ . '/compat/wordpress-5.9/block-template.php';
require __DIR__ . '/compat/wordpress-5.9/wp-theme-get-post-templates.php';
Expand Down

0 comments on commit 586f999

Please sign in to comment.