diff --git a/classes/class-controls.php b/classes/class-controls.php index 3f21fd67..4d732062 100644 --- a/classes/class-controls.php +++ b/classes/class-controls.php @@ -66,12 +66,6 @@ public function filter_control_value( $value, $control_data, $block_data, $conte $value = apply_filters( 'lzb/control_value/control_type=' . $control_data['type'], $value, $control_data, $block_data, $context ); $value = apply_filters( 'lzb/control_value/control_name=' . $control_data['name'], $value, $control_data, $block_data, $context ); $value = apply_filters( 'lzb/control_value/block_slug=' . $block_data['slug'], $value, $control_data, $block_data, $context ); - - // added embed support for classic editor control. - if ( 'classic_editor' === $control_data['type'] ) { - global $wp_embed; - $value = $wp_embed->autoembed( $value ); - } } return $value; diff --git a/controls/classic_editor/index.php b/controls/classic_editor/index.php index 21a610fc..578f366a 100644 --- a/controls/classic_editor/index.php +++ b/controls/classic_editor/index.php @@ -51,6 +51,26 @@ public function get_script_depends() { return array( 'lazyblocks-control-classic-editor' ); } + + /** + * Embed support for classic editor control. + * + * @param mixed $value - control value. + * @param array $control_data - control data. + * @param array $block_data - block data. + * @param string $context - block render context. + * + * @return string|array + */ + // phpcs:ignore + public function filter_control_value( $value, $control_data, $block_data, $context ) { + if ( 'classic_editor' === $control_data['type'] ) { + global $wp_embed; + $value = $wp_embed->autoembed( $value ); + } + + return $value; + } } new LazyBlocks_Control_ClassicEditor();