// The widgets editor does not support the Block Directory, so don't load any of // its assets. This also prevents 'wp-editor' from being enqueued which we // cannot load in the widgets screen because many widget scripts rely on `wp.editor`. remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
/** This action is documented in wp-admin/widgets-form.php */ do_action( 'widgets_admin_page' ); ?>
<div id="widgets-editor" class="blocks-widgets-container"> <?php // JavaScript is disabled. ?> <div class="wrap hide-if-js widgets-editor-no-js"> <h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> <?php if ( file_exists( WP_PLUGIN_DIR . '/classic-widgets/classic-widgets.php' ) ) { // If Classic Widgets is already installed, provide a link to activate the plugin. $installed = true; $plugin_activate_url = wp_nonce_url( 'plugins.php?action=activate&plugin=classic-widgets/classic-widgets.php', 'activate-plugin_classic-widgets/classic-widgets.php' ); $message = sprintf( /* translators: %s: Link to activate the Classic Widgets plugin. */ __( 'The block widgets require JavaScript. Please enable JavaScript in your browser settings, or activate the <a href="%s">Classic Widgets plugin</a>.' ), esc_url( $plugin_activate_url ) ); } else { // If Classic Widgets is not installed, provide a link to install it. $installed = false; $plugin_install_url = wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=classic-widgets' ), 'install-plugin_classic-widgets' ); $message = sprintf( /* translators: %s: A link to install the Classic Widgets plugin. */ __( 'The block widgets require JavaScript. Please enable JavaScript in your browser settings, or install the <a href="%s">Classic Widgets plugin</a>.' ), esc_url( $plugin_install_url ) ); } /** * Filters the message displayed in the block widget interface when JavaScript is * not enabled in the browser. * * @since 6.4.0 * * @param string $message The message being displayed. * @param bool $installed Whether the Classic Widget plugin is installed. */ $message = apply_filters( 'block_widgets_no_javascript_message', $message, $installed ); wp_admin_notice( $message, array( 'type' => 'error', 'additional_classes' => array( 'hide-if-js' ), ) ); ?> </div> </div>
<?php /** This action is documented in wp-admin/widgets-form.php */ do_action( 'sidebar_admin_page' );