start_controls_section( 'section_options', [ 'label' => esc_html__( 'Options', 'adirectory' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $directory_types = wp_list_pluck( adqs_get_directories(), 'name', 'slug' ) ?? []; $this->add_control( 'custom_directory', [ 'label' => esc_html__( 'Include Directories', 'adirectory' ), 'type' => \Elementor\Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => $directory_types, ] ); $this->add_control( 'directory_dropdown', [ 'label' => esc_html__( 'Directory Dropdown After', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'step' => 1, 'default' => 6, ] ); // Toggle: Show/Hide Categories filter $this->add_control( 'display_categories', [ 'label' => esc_html__( 'Show Categories Filter', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'adirectory' ), 'label_off' => esc_html__( 'Hide', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); // Toggle: Show/Hide Locations filter $this->add_control( 'display_locations', [ 'label' => esc_html__( 'Show Locations Filter', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'adirectory' ), 'label_off' => esc_html__( 'Hide', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'search_page_url', [ 'label' => esc_html__( 'Search Page URL', 'adirectory' ), 'type' => Controls_Manager::URL, 'label_block' => true, 'options' => false, ] ); $this->add_control( 'search_page_notice', [ 'type' => \Elementor\Controls_Manager::NOTICE, 'notice_type' => 'warning', 'dismissible' => true, 'heading' => esc_html__( 'Add Search Page URL', 'adirectory' ), 'content' => esc_html__( 'Add your Search page Url here.For exapmle: You can put you all listing page URL here.', 'adirectory' ), ] ); $this->add_control( 'new_tab', [ 'label' => esc_html__( 'Open New Tab ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->end_controls_section(); // end: Section $this->start_controls_section( 'golbal_color', [ 'label' => esc_html__( 'Global Color', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'area_bg_color', [ 'label' => esc_html__( 'Area Background Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-main-box.qsd-search-bar' => 'background-color: {{VALUE}};', ], ] ); $this->add_control( 'golbal_primary_color', [ 'label' => esc_html__( 'Primary Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--color-primary: {{VALUE}}', ], ] ); $this->add_control( 'golbal_secondary_color', [ 'label' => esc_html__( 'Secondary Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--color-secondary: {{VALUE}}', ], ] ); $this->add_control( 'input_color', [ 'label' => esc_html__( 'Input Text Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .qsd-form-input' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'input_placeholder_color', [ 'label' => esc_html__( 'Input Placeholder Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ // Cross-browser placeholder support '{{WRAPPER}} .qsd-form-input::placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .qsd-form-input::-webkit-input-placeholder' => 'color: {{VALUE}} !important;', '{{WRAPPER}} .qsd-form-input:-moz-placeholder' => 'color: {{VALUE}} !important; opacity: 1;', '{{WRAPPER}} .qsd-form-input::-moz-placeholder' => 'color: {{VALUE}} !important; opacity: 1;', '{{WRAPPER}} .qsd-form-input:-ms-input-placeholder' => 'color: {{VALUE}} !important;', ], ] ); $this->end_controls_section(); // Style controle $this->start_controls_section( 'search_box_styles', [ 'label' => esc_html__( 'Search Box', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .qsd-prodcut-main-box', ] ); $this->add_responsive_control( 'searchbox_padding', [ 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'label' => esc_html__( 'Padding', 'adirectory' ), 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-main-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'border', 'selector' => '{{WRAPPER}} .qsd-prodcut-main-box', ] ); $this->add_responsive_control( 'searchbox_border_radius', [ 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'label' => esc_html__( 'Border Radius', 'adirectory' ), 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-main-box' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_shadow', 'selector' => '{{WRAPPER}} .qsd-prodcut-main-box', ] ); $this->end_controls_section(); $this->start_controls_section( 'searchbox_button_styles', [ 'label' => esc_html__( 'Search Button', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); // Addlist Button Styles Tab Control $this->start_controls_tabs( 'searchbox_button_style_tabs' ); $this->start_controls_tab( 'searchbox_button_style_normal_tab', [ 'label' => esc_html__( 'Normal', 'adirectory' ), ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'searchbox_content_typography', 'selector' => '{{WRAPPER}} .qsd-main-btn', 'global' => [ 'default' => \Elementor\Core\Kits\Documents\Tabs\Global_Typography::TYPOGRAPHY_TEXT, ], ] ); $this->add_control( 'searchbox_button_text_color', [ 'label' => esc_html__( 'Text Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .qsd-main-btn' => 'color: {{VALUE}} !important', ], ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'searchbox_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .qsd-main-btn', ] ); $this->add_responsive_control( 'searchbox_button_padding', [ 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'label' => esc_html__( 'Padding', 'adirectory' ), 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .qsd-main-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'searchbox_border', 'selector' => '{{WRAPPER}} .qsd-main-btn', ] ); $this->add_responsive_control( 'searchbox_button_border_radius', [ 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'label' => esc_html__( 'Border Radius', 'adirectory' ), 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .qsd-main-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'searchbox_button_style_hoverl_tab', [ 'label' => esc_html__( 'Hover', 'adirectory' ), ] ); $this->add_control( 'searchbox_button_hover_text_color', [ 'label' => esc_html__( 'Text Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .qsd-main-btn:hover' => 'color: {{VALUE}} !important', ], ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'searchbox_hover_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}} .qsd-main-btn:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); $this->start_controls_section( 'search_input_box_styles', [ 'label' => esc_html__( 'Search Input', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'searchbox_input_typography', 'selector' => '{{WRAPPER}} .qsd-form-select, {{WRAPPER}} .qsd-form-input', ] ); $this->add_control( 'searchbox_input_text_color', [ 'label' => esc_html__( 'Text Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .qsd-form-select,{{WRAPPER}} .qsd-form-input' => 'color: {{VALUE}} !important', ], ] ); $this->add_responsive_control( 'searchbox_input_text_border_radius', [ 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'label' => esc_html__( 'Border Radius', 'adirectory' ), 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .qsd-searchBar-wrap .qsd-form-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Render Advanced widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $action_elementor = Plugin::instance()->editor->is_edit_mode() ? true : false; $search_page_url = $settings['search_page_url']['url'] ?? ''; $new_tab = $settings['new_tab'] ?? 'true'; $directory_dropdown = $settings['directory_dropdown'] ?? 5; $display_categories = $settings['display_categories'] ?? 'true'; $display_locations = $settings['display_locations'] ?? 'true'; $style_type = $settings['style_type'] ?? ''; // Handle multi-directory taxonomies $custom_directory = $this->get_join_data( $settings['custom_directory'] ?? [] ); $shortcode = "[adqs_search search_page_url='{$search_page_url}' custom_directory='{$custom_directory}' directory_dropdown='{$directory_dropdown}' display_categories='{$display_categories}' display_locations='{$display_locations}' new_tab='{$new_tab}' style_type='{$style_type}' ]"; echo do_shortcode( $shortcode ); } /** * Render widget output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 1.0.0 * @access protected */ // protected function _content_template(){} } Plugin::instance()->widgets_manager->register( new Listing_Search_Bar() );