From 7e3b648d7484200313bb333bbc4e63f244fff3db Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Wed, 2 Jun 2021 01:56:35 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@51061 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/widgets-form-blocks.php | 6 ++++++ src/wp-admin/widgets-form.php | 4 ---- src/wp-admin/widgets.php | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/widgets-form-blocks.php b/src/wp-admin/widgets-form-blocks.php index 6f209da27f..4af4bd051b 100644 --- a/src/wp-admin/widgets-form-blocks.php +++ b/src/wp-admin/widgets-form-blocks.php @@ -55,6 +55,9 @@ wp_enqueue_style( 'wp-edit-widgets' ); /** This action is documented in wp-admin/edit-form-blocks.php */ 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'; /** This action is documented in wp-admin/widgets-form.php */ @@ -64,4 +67,7 @@ do_action( 'widgets_admin_page' );
set_help_sidebar( '

' . __( 'Support' ) . '

' ); -if ( ! current_theme_supports( 'widgets' ) ) { - wp_die( __( 'The theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please follow these instructions.' ) ); -} - // These are the widgets grouped by sidebar. $sidebars_widgets = wp_get_sidebars_widgets(); diff --git a/src/wp-admin/widgets.php b/src/wp-admin/widgets.php index 303ebb0bc9..88a58f59ba 100644 --- a/src/wp-admin/widgets.php +++ b/src/wp-admin/widgets.php @@ -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’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please follow these instructions.' ) ); +} + $title = __( 'Widgets' ); $parent_file = 'themes.php';