esc_html__( 'Embed your saved elements.', 'elementor-pro' ), ] ); } /** * @param array $args * @param array $instance */ public function widget( $args, $instance ) { // PHPCS - Theme arg echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( ! empty( $instance['title'] ) ) { /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); // PHPCS - Theme arg echo $args['before_title'] . esc_html( $title ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } if ( ! empty( $instance['template_id'] ) && 'publish' === get_post_status( $instance['template_id'] ) ) { $this->sidebar_id = $args['id']; add_filter( 'elementor/frontend/builder_content_data', [ $this, 'filter_content_data' ] ); // PHPCS - the main content echo Plugin::elementor()->frontend->get_builder_content_for_display( $instance['template_id'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped remove_filter( 'elementor/frontend/builder_content_data', [ $this, 'filter_content_data' ] ); unset( $this->sidebar_id ); } // PHPCS - Theme arg echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Avoid nesting a sidebar within a template that will appear in the sidebar itself * * @param array $data * * @return mixed */ public function filter_content_data( $data ) { if ( ! empty( $data ) ) { $data = Plugin::elementor()->db->iterate_data( $data, function( $element ) { if ( 'widget' === $element['elType'] && 'sidebar' === $element['widgetType'] && $this->sidebar_id === $element['settings']['sidebar'] ) { $element['settings']['sidebar'] = null; } return $element; } ); } return $data; } /** * @param array $instance * * @return void */ public function form( $instance ) { $default = [ 'title' => '', 'template_id' => '', ]; $instance = array_merge( $default, $instance ); $templates = Module::get_templates(); if ( ! $templates ) { // PHPCS - the method empty_templates_message is safe. echo Module::empty_templates_message(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped return; } ?>

href="" >