Widgets: Add missing actions to widgets block editor

Adds the `'sidebar_admin-setup'`, `'sidebar_admin_page'`, and
`current_theme_supports( 'widgets' )` check to the widgets block editor so that
the block editor screen is more compatible with the classic screen.

Fixes #53288.
Props isabel_brison.

Built from https://develop.svn.wordpress.org/trunk@51061


git-svn-id: http://core.svn.wordpress.org/trunk@50670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
noisysocks 2021-06-02 01:57:57 +00:00
parent 5162c8e6a8
commit 138fa081a7
4 changed files with 11 additions and 5 deletions

View File

@ -55,6 +55,9 @@ wp_enqueue_style( 'wp-edit-widgets' );
/** This action is documented in wp-admin/edit-form-blocks.php */ /** This action is documented in wp-admin/edit-form-blocks.php */
do_action( 'enqueue_block_editor_assets' ); do_action( 'enqueue_block_editor_assets' );
/** This action is documented in wp-admin/widgets-form.php */
do_action( 'sidebar_admin_setup' );
require_once ABSPATH . 'wp-admin/admin-header.php'; require_once ABSPATH . 'wp-admin/admin-header.php';
/** This action is documented in wp-admin/widgets-form.php */ /** This action is documented in wp-admin/widgets-form.php */
@ -64,4 +67,7 @@ do_action( 'widgets_admin_page' );
<div id="widgets-editor" class="blocks-widgets-container"></div> <div id="widgets-editor" class="blocks-widgets-container"></div>
<?php <?php
/** This action is documented in wp-admin/widgets-form.php */
do_action( 'sidebar_admin_page' );
require_once ABSPATH . 'wp-admin/admin-footer.php'; require_once ABSPATH . 'wp-admin/admin-footer.php';

View File

@ -72,10 +72,6 @@ get_current_screen()->set_help_sidebar(
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
); );
if ( ! current_theme_supports( 'widgets' ) ) {
wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://developer.wordpress.org/themes/functionality/widgets/">follow these instructions</a>.' ) );
}
// These are the widgets grouped by sidebar. // These are the widgets grouped by sidebar.
$sidebars_widgets = wp_get_sidebars_widgets(); $sidebars_widgets = wp_get_sidebars_widgets();

View File

@ -20,6 +20,10 @@ if ( ! current_user_can( 'edit_theme_options' ) ) {
); );
} }
if ( ! current_theme_supports( 'widgets' ) ) {
wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://developer.wordpress.org/themes/functionality/widgets/">follow these instructions</a>.' ) );
}
$title = __( 'Widgets' ); $title = __( 'Widgets' );
$parent_file = 'themes.php'; $parent_file = 'themes.php';

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.8-alpha-51060'; $wp_version = '5.8-alpha-51061';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.