start_controls_section( 'content_section', [ 'label' => __( 'Insert Appointment Hour Booking', 'cptslotsb' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $forms = array(); $rows = $wpdb->get_results("SELECT id,form_name FROM ".$wpdb->prefix.$cp_appb_plugin->table_items." ORDER BY form_name"); foreach ($rows as $item) $forms[$item->id] = $item->form_name; $this->add_control( 'formid', [ 'label' => __( 'Select Form', 'cptslotsb' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '1', 'options' => $forms, ] ); $this->end_controls_section(); } /** * Render widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { global $cp_appb_plugin; $settings = $this->get_settings_for_display(); $id = $settings["formid"]; $cp_appb_plugin->setId($id); if ( ! \Elementor\Plugin::instance()->editor->is_edit_mode() ) { echo $cp_appb_plugin->filter_content( array("id" => $id) ); return; } else { $cp_appb_plugin->print_counter = mt_rand(99999,999999); $counter = $cp_appb_plugin->print_counter; define('APHOURBK_ELEMENTOR_EDIT_MODE', true); echo '
'; echo ''; } } } \Elementor\Plugin::instance()->widgets_manager->register_widget_type(new Elementor_CPAppHourBK_Widget());