From bd157b164ec2b9ea0fb3e7802763de6b449d533b Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Thu, 20 Aug 2020 13:21:03 +0100 Subject: [PATCH] Fix phpcs --- gutenberg.php | 9 ++++++--- lib/customizer.php | 12 ++++++------ lib/widgets.php | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/gutenberg.php b/gutenberg.php index 407f98d0a0c67..460196de9bd7a 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -53,9 +53,12 @@ function gutenberg_menu() { 'gutenberg-widgets', 'the_gutenberg_widgets' ); - $submenu['themes.php'] = array_filter( $submenu['themes.php'], function( $current_menu_item ) { - return isset( $current_menu_item[ 2 ] ) && $current_menu_item[ 2 ] !== 'widgets.php'; - } ); + $submenu['themes.php'] = array_filter( + $submenu['themes.php'], + function( $current_menu_item ) { + return isset( $current_menu_item[2] ) && 'widgets.php' !== $current_menu_item[2]; + } + ); } if ( get_option( 'gutenberg-experiments' ) ) { diff --git a/lib/customizer.php b/lib/customizer.php index 5ea5872e7ec61..7de79e88619cf 100644 --- a/lib/customizer.php +++ b/lib/customizer.php @@ -85,15 +85,15 @@ function gutenberg_remove_widgets_panel( $components ) { return $components; } - $i = array_search( 'widgets', $components ); - if ( false !== $i ) { - unset( $components[ $i ] ); - } - return $components; + $i = array_search( 'widgets', $components, true ); + if ( false !== $i ) { + unset( $components[ $i ] ); + } + return $components; } add_filter( 'customize_loaded_components', 'gutenberg_remove_widgets_panel' ); -/* +/** * Filters the Customizer widget settings arguments. * This is needed because the Customizer registers settings for the raw registered widgets, without going through the `sidebars_widgets` filter. * The `WP_Customize_Widgets` class expects sidebars to have an array of widgets registered, not a post ID. diff --git a/lib/widgets.php b/lib/widgets.php index 4aa869970efc7..73e23eaa9bb90 100644 --- a/lib/widgets.php +++ b/lib/widgets.php @@ -270,4 +270,4 @@ function gutenberg_register_widgets() { } } -add_action( 'widgets_init', 'gutenberg_register_widgets' ); \ No newline at end of file +add_action( 'widgets_init', 'gutenberg_register_widgets' );