start_controls_section( 'section_content', [ 'label' => esc_html__( 'Comments', 'elementor-pro' ), ] ); $this->add_control( '_skin', [ 'type' => Controls_Manager::HIDDEN, ] ); $this->add_control( 'skin_temp', [ 'label' => esc_html__( 'Skin', 'elementor-pro' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__( 'Theme Comments', 'elementor-pro' ), ], 'description' => esc_html__( 'The Theme Comments skin uses the currently active theme comments design and layout to display the comment form and comments.', 'elementor-pro' ), ] ); $this->add_control( 'source_type', [ 'label' => esc_html__( 'Source', 'elementor-pro' ), 'type' => Controls_Manager::SELECT, 'options' => [ Module::SOURCE_TYPE_CURRENT_POST => esc_html__( 'Current Post', 'elementor-pro' ), Module::SOURCE_TYPE_CUSTOM => esc_html__( 'Custom', 'elementor-pro' ), ], 'default' => Module::SOURCE_TYPE_CURRENT_POST, 'separator' => 'before', ] ); $this->add_control( 'source_custom', [ 'label' => esc_html__( 'Search & Select', 'elementor-pro' ), 'type' => QueryControlModule::QUERY_CONTROL_ID, 'label_block' => true, 'autocomplete' => [ 'object' => QueryControlModule::QUERY_OBJECT_POST, ], 'condition' => [ 'source_type' => Module::SOURCE_TYPE_CUSTOM, ], ] ); $this->end_controls_section(); } public function render() { $settings = $this->get_settings(); if ( Module::SOURCE_TYPE_CUSTOM === $settings['source_type'] ) { $post_id = (int) $settings['source_custom']; Plugin::elementor()->db->switch_to_post( $post_id ); } if ( ! comments_open() && ( Plugin::elementor()->preview->is_preview_mode() || Plugin::elementor()->editor->is_edit_mode() ) ) : ?>