PluginProbe
Gutenberg / 8.9.2
Gutenberg v8.9.2
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | lib/customizer.php +15 -21 7.4.08.9.2 View file →
@@ -54,12 +54,13 @@
54 54 'transport' => 'postMessage',
55 55 'sanitize_callback' => 'gutenberg_customize_sanitize',
56 56 )
57 57 );
58 - if ( gutenberg_is_experiment_enabled( 'gutenberg-widget-experiments' ) ) {
58 +
59 + if ( gutenberg_use_widgets_block_editor() ) {
59 60 $wp_customize->add_section(
60 61 'gutenberg_widget_blocks',
61 - array( 'title' => __( 'Widget Blocks (Experimental)', 'gutenberg' ) )
62 + array( 'title' => __( 'Widget Blocks', 'gutenberg' ) )
62 63 );
63 64 $wp_customize->add_control(
64 65 new WP_Customize_Widget_Blocks_Control(
65 66 $wp_customize,
@@ -74,32 +75,25 @@
74 75 }
75 76 add_action( 'customize_register', 'gutenberg_customize_register' );
76 77
77 78 /**
78 - * Specifies how to save the `gutenberg_widget_blocks` setting. It parses the JSON string and updates the
79 - * referenced widget areas with the new content.
79 + * Removes the core 'Widgets' panel from the Customizer if block based widgets are enabled.
80 80 *
81 - * @param string $value The value that is being published.
82 - * @param \WP_Customize_Setting $setting The setting instance.
81 + * @param array $components Core Customizer components list.
82 + * @return array (Maybe) modified components list.
83 83 */
84 -function gutenberg_customize_update( $value, $setting ) {
85 - foreach ( json_decode( $value ) as $sidebar_id => $sidebar_content ) {
86 - $id_referenced_in_sidebar = Experimental_WP_Widget_Blocks_Manager::get_post_id_referenced_in_sidebar( $sidebar_id );
84 +function gutenberg_remove_widgets_panel( $components ) {
85 + if ( ! gutenberg_use_widgets_block_editor() ) {
86 + return $components;
87 + }
87 88
88 - $post_id = wp_insert_post(
89 - array(
90 - 'ID' => $id_referenced_in_sidebar,
91 - 'post_content' => $sidebar_content,
92 - 'post_type' => 'wp_area',
93 - )
94 - );
95 -
96 - if ( 0 === $id_referenced_in_sidebar ) {
97 - Experimental_WP_Widget_Blocks_Manager::reference_post_id_in_sidebar( $sidebar_id, $post_id );
98 - }
89 + $i = array_search( 'widgets', $components, true );
90 + if ( false !== $i ) {
91 + unset( $components[ $i ] );
99 92 }
93 + return $components;
100 94 }
101 -add_action( 'customize_update_gutenberg_widget_blocks', 'gutenberg_customize_update', 10, 2 );
95 +add_filter( 'customize_loaded_components', 'gutenberg_remove_widgets_panel' );
102 96
103 97 /**
104 98 * Filters the Customizer widget settings arguments.
105 99 * This is needed because the Customizer registers settings for the raw registered widgets, without going through the `sidebars_widgets` filter.