From a6d86ac1294d3b4922bfa9ee94096ae2c90b1714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Fri, 28 Aug 2020 18:17:06 +0200 Subject: [PATCH] Use textarea instead of block preview --- gutenberg.php | 30 ------------------------------ lib/class-wp-widget-block.php | 3 +-- lib/widgets-page.php | 2 +- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/gutenberg.php b/gutenberg.php index e6a0c32099d909..6c5a1966a0b5c6 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -191,36 +191,6 @@ function gutenberg_register_widgets() { } register_widget( 'WP_Widget_Block' ); - // By default every widget on widgets.php is wrapped with a
. - // This means that you can sometimes end up with invalid HTML, e.g. when - // one of the widgets is a Search block. - // - // To fix the problem, let's add a filter that moves the form below the actual - // widget content. - global $pagenow; - if ( 'widgets.php' === $pagenow ) { - add_filter( - 'dynamic_sidebar_params', - 'gutenberg_override_sidebar_params_for_block_widget' - ); - } -} - -/** - * Overrides dynamic_sidebar_params to make sure Blocks are not wrapped in tag. - * - * @param array $arg Dynamic sidebar params. - * @return array Updated dynamic sidebar params. - */ -function gutenberg_override_sidebar_params_for_block_widget( $arg ) { - if ( 'Block' === $arg[0]['widget_name'] ) { - $arg[0]['before_form'] = ''; - $arg[0]['before_widget_content'] = '
'; - $arg[0]['after_widget_content'] = '
'; - $arg[0]['after_form'] = '
'; - } - - return $arg; } add_action( 'widgets_init', 'gutenberg_register_widgets' ); diff --git a/lib/class-wp-widget-block.php b/lib/class-wp-widget-block.php index a9eb407abddc4c..f1ca4b3c034fdd 100644 --- a/lib/class-wp-widget-block.php +++ b/lib/class-wp-widget-block.php @@ -80,9 +80,8 @@ public function update( $new_instance, $old_instance ) { */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, $this->default_instance ); - echo do_blocks( $instance['content'] ); ?> - +