'wp'] ) ) {
$widget = $this->get_widget_instance();
$instance = $widget->update( $settings['wp'], [] );
/** This filter is documented in wp-includes/class-wp-widget.php */
$settings['wp'] = apply_filters( 'widget_update_callback', $instance, $settings['wp'], [], $widget );
}
return $settings;
}
/**
* Register WordPress widget controls.
*
* Adds different input fields to allow the user to change and customize the widget settings.
*
* @since 3.1.0
* @access protected
*/
protected function register_controls() {
$this->add_control(
'wp',
[
'label' => esc_html__( 'Form', 'elementor' ),
'type' => Controls_Manager::WP_WIDGET,
'widget' => $this->get_name(),
'id_base' => $this->get_widget_instance()->id_base,
]
);
}
/**
* Render WordPress widget output on the frontend.
*
* Written in PHP and used to generate the final HTML.
*
* @since 1.0.0
* @access protected
*/
protected function render() {
$default_widget_args = [
'widget_id' => $this->get_name(),
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
];
/**
* WordPress widget args.
*
* Filters the WordPress widget arguments when they are rendered in Elementor panel.
*
* @since 1.0.0
*
* @param array $default_widget_args Default widget arguments.
* @param Widget_WordPress $this The WordPress widget.
*/
$default_widget_args = apply_filters( 'elementor/widgets/wordpress/widget_args', $default_widget_args, $this );
$is_gallery_widget = 'wp-widget-media_gallery' === $this->get_name();
if ( $is_gallery_widget ) {
add_filter( 'wp_get_attachment_link', [ $this, 'add_lightbox_data_to_image_link' ], 10, 2 );
}
$this->get_widget_instance()->widget( $default_widget_args, $this->get_settings( 'wp' ) );
if ( $is_gallery_widget ) {
remove_filter( 'wp_get_attachment_link', [ $this, 'add_lightbox_data_to_image_link' ] );
}
}
/**
* Render WordPress widget output in the editor.
*
* Written as a Backbone JavaScript template and used to generate the live preview.
*
* @since 2.9.0
* @access protected
*/
protected function content_template() {}
/**
* WordPress widget constructor.
*
* Used to run WordPress widget constructor.
*
* @since 1.0.0
* @access public
*
* @param array $data Widget data. Default is an empty array.
* @param array $args Widget arguments. Default is null.
*/
public function __construct( $data = [], $args = null ) {
$this->_widget_name = $args['widget_name'];
parent::__construct( $data, $args );
}
/**
* Render WordPress widget as plain content.
*
* Override the default render behavior, don't render widget content.
*
* @since 1.0.0
* @access public
*
* @param array $instance Widget instance. Default is empty array.
*/
public function render_plain_content( $instance = [] ) {}
}