Skip to content

Commit

Permalink
Link to widgets.php instead of themes.php?page=gutenberg-widgets (#32299
Browse files Browse the repository at this point in the history
)
  • Loading branch information
noisysocks authored May 31, 2021
1 parent dcbd481 commit 71f8925
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
16 changes: 13 additions & 3 deletions lib/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ function gutenberg_menu() {
'gutenberg'
);

if ( gutenberg_use_widgets_block_editor() ) {
if (
gutenberg_use_widgets_block_editor() &&
! function_exists( 'wp_use_widgets_block_editor' )
) {
add_theme_page(
__( 'Widgets', 'gutenberg' ),
__( 'Widgets', 'gutenberg' ),
Expand Down Expand Up @@ -113,7 +116,11 @@ function gutenberg_site_editor_menu() {
* @param WP_Admin_Bar $wp_admin_bar Core class used to implement the Toolbar API.
*/
function modify_admin_bar( $wp_admin_bar ) {
if ( gutenberg_use_widgets_block_editor() && $wp_admin_bar->get_node( 'widgets' ) !== null ) {
if (
gutenberg_use_widgets_block_editor() &&
! function_exists( 'wp_use_widgets_block_editor' ) &&
$wp_admin_bar->get_node( 'widgets' ) !== null
) {
$wp_admin_bar->add_menu(
array(
'id' => 'widgets',
Expand All @@ -137,7 +144,10 @@ function modify_welcome_panel() {
ob_start();
wp_welcome_panel();
$welcome_panel = ob_get_clean();
if ( gutenberg_use_widgets_block_editor() ) {
if (
gutenberg_use_widgets_block_editor() &&
! function_exists( 'wp_use_widgets_block_editor' )
) {
echo str_replace(
admin_url( 'widgets.php' ),
admin_url( 'themes.php?page=gutenberg-widgets' ),
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/legacy-widget/edit/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ export default function Preview( { idBase, instance, isVisible } ) {
// TODO: This chokes when the query param is too big.
// Ideally, we'd render a <ServerSideRender>. Maybe by
// rendering one in an iframe via a portal.
src={ addQueryArgs( 'themes.php', {
page: 'gutenberg-widgets',
src={ addQueryArgs( 'widgets.php', {
'legacy-widget-preview': {
idBase,
instance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function WidgetAreas( { selectedWidgetAreaId } ) {
<Button
href={ addQueryArgs( 'customize.php', {
'autofocus[panel]': 'widgets',
return: 'themes.php?page=gutenberg-widgets',
return: window.location.pathname,
} ) }
variant="tertiary"
>
Expand Down

0 comments on commit 71f8925

Please sign in to comment.