WordPress/wp-admin/widgets.php
noisysocks 138fa081a7 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
2021-06-02 01:57:57 +00:00

35 lines
1.1 KiB
PHP

<?php
/**
* Widget administration screen.
*
* @package WordPress
* @subpackage Administration
*/
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';
/** WordPress Administration Widgets API */
require_once ABSPATH . 'wp-admin/includes/widgets.php';
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die(
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
403
);
}
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' );
$parent_file = 'themes.php';
if ( wp_use_widgets_block_editor() ) {
require ABSPATH . 'wp-admin/widgets-form-blocks.php';
} else {
require ABSPATH . 'wp-admin/widgets-form.php';
}