PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 3.8.9
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v3.8.9
4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 All 200 releases
← All changes | includes/Editors/Elementor/Widget/Basic/SearchForm.php +49 -548 4.9.03.8.9 View file →
@@ -5,16 +5,8 @@
5 5 if ( ! defined( 'ABSPATH' ) ) {
6 6 exit;
7 7 }
8 8
9 -
10 -// Doc/category-listing primitives (meta_query/tax_query, post__not_in/exclude)
11 -// are intrinsic to BetterDocs' KB / category / FAQ filters and intentional.
12 -// phpcs:disable WordPress.DB.SlowDBQuery.slow_db_query_meta_key
13 -// phpcs:disable WordPress.DB.SlowDBQuery.slow_db_query_meta_query
14 -// phpcs:disable WordPress.DB.SlowDBQuery.slow_db_query_tax_query
15 -// phpcs:disable WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
16 -// phpcs:disable WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_post__not_in
17 9 use Elementor\Group_Control_Background;
18 10 use Elementor\Controls_Manager;
19 11 use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget;
20 12 use Elementor\Group_Control_Border;
@@ -85,9 +77,8 @@
85 77 $this->search_result_list_layout_1();
86 78
87 79 $this->search_box_layout_2();
88 80 $this->search_field_layout_2();
89 - $this->ai_search_suggestions_controls();
90 81 $this->search_modal_layout();
91 82 }
92 83
93 84 public function layout_selection() {
@@ -112,79 +103,8 @@
112 103 ]
113 104 ]
114 105 );
115 106
116 - $this->add_control(
117 - 'search_modal_layout',
118 - [
119 - 'label' => __( 'Search Modal Layout', 'betterdocs' ),
120 - 'type' => Controls_Manager::SELECT,
121 - 'default' => 'layout-1',
122 - 'label_block' => false,
123 - 'options' => [
124 - 'layout-1' => esc_html__( 'Layout 1', 'betterdocs' ),
125 - 'docs-archive' => esc_html__( 'Layout 2', 'betterdocs' ),
126 - 'sidebar' => esc_html__( 'Layout 3', 'betterdocs' )
127 - ],
128 - 'condition' => [
129 - 'layout_select' => [ 'layout-2' ]
130 - ]
131 - ]
132 - );
133 -
134 - $this->add_control(
135 - 'search_modal_width',
136 - [
137 - 'label' => __( 'Width', 'betterdocs' ),
138 - 'type' => Controls_Manager::SLIDER,
139 - 'size_units' => [ '%', 'px' ],
140 - 'range' => [
141 - '%' => [
142 - 'min' => 10,
143 - 'max' => 100,
144 - ],
145 - 'px' => [
146 - 'min' => 100,
147 - 'max' => 1200,
148 - ],
149 - ],
150 - 'default' => [
151 - 'unit' => '%',
152 - 'size' => 100,
153 - ],
154 - 'selectors' => [
155 - '{{WRAPPER}} .betterdocs-search-modal-archive' => 'width: {{SIZE}}{{UNIT}};max-width: 100%;',
156 - '{{WRAPPER}} .betterdocs-search-modal-sidebar' => 'width: {{SIZE}}{{UNIT}};',
157 - ],
158 - 'condition' => [
159 - 'layout_select' => [ 'layout-2' ],
160 - 'search_modal_layout' => [ 'docs-archive', 'sidebar' ]
161 - ]
162 - ]
163 - );
164 -
165 - $this->add_control(
166 - 'search_modal_position',
167 - [
168 - 'label' => __( 'Position', 'betterdocs' ),
169 - 'type' => Controls_Manager::SELECT,
170 - 'default' => 'left',
171 - 'options' => [
172 - 'left' => __( 'Left', 'betterdocs' ),
173 - 'right' => __( 'Right', 'betterdocs' ),
174 - ],
175 - 'selectors' => [
176 - '{{WRAPPER}}' => 'text-align: {{VALUE}};',
177 - '{{WRAPPER}} .betterdocs-search-modal-archive' => 'display: inline-block; text-align: left;',
178 - '{{WRAPPER}} .betterdocs-search-modal-sidebar' => 'display: inline-block; text-align: left;',
179 - ],
180 - 'condition' => [
181 - 'layout_select' => [ 'layout-2' ],
182 - 'search_modal_layout' => [ 'docs-archive', 'sidebar' ]
183 - ]
184 - ]
185 - );
186 -
187 107 $this->end_controls_section();
188 108 }
189 109
190 110 public function search_modal_query() {
@@ -197,8 +117,32 @@
197 117 ]
198 118 ]
199 119 );
200 120
121 + // $this->add_control(
122 + // 'include_doc_categories',
123 + // [
124 + // 'label' => __( 'Doc Categories', 'betterdocs' ),
125 + // 'label_block' => true,
126 + // 'type' => Controls_Manager::SELECT2,
127 + // 'options' => array_reduce( get_terms( ['taxonomy' => 'doc_category', 'hide_empty' => true] ), [$this, 'return_mod_terms'] ),
128 + // 'multiple' => true,
129 + // 'default' => []
130 + // ]
131 + // );
132 +
133 + // $this->add_control(
134 + // 'include_faq',
135 + // [
136 + // 'label' => __( 'FAQ', 'betterdocs' ),
137 + // 'label_block' => true,
138 + // 'type' => Controls_Manager::SELECT2,
139 + // 'options' => array_reduce( get_terms(['taxonomy' => 'betterdocs_faq_category']), [$this, 'return_mod_terms'] ),
140 + // 'multiple' => true,
141 + // 'default' => []
142 + // ]
143 + // );
144 +
201 145 $this->add_control(
202 146 'search_modal_doc_query_type',
203 147 [
204 148 'label' => __( 'Select Docs Type', 'betterdocs' ),
@@ -294,10 +238,8 @@
294 238
295 239 $this->end_controls_section();
296 240 }
297 241
298 -
299 -
300 242 public function return_mod_terms( $accumulator, $term ) {
301 243 $accumulator[ $term->term_id ] = htmlspecialchars_decode( $term->name );
302 244 return $accumulator;
303 245 }
@@ -324,38 +266,9 @@
324 266 $this->add_control(
325 267 'section_search_field_heading',
326 268 [
327 269 'label' => __( 'Search Heading', 'betterdocs' ),
328 - 'type' => Controls_Manager::TEXT,
329 - 'condition' => [
330 - 'layout_select' => 'layout-1',
331 - 'search_modal_layout' => 'layout-1'
332 - ],
333 - 'conditions' => [
334 - 'relation' => 'or',
335 - 'terms' => [
336 - [
337 - 'name' => 'layout_select',
338 - 'operator' => '==',
339 - 'value' => 'layout-1'
340 - ],
341 - [
342 - 'relation' => 'and',
343 - 'terms' => [
344 - [
345 - 'name' => 'layout_select',
346 - 'operator' => '==',
347 - 'value' => 'layout-2'
348 - ],
349 - [
350 - 'name' => 'search_modal_layout',
351 - 'operator' => '==',
352 - 'value' => 'layout-1'
353 - ]
354 - ]
355 - ]
356 - ]
357 - ]
270 + 'type' => Controls_Manager::TEXT
358 271 ]
359 272 );
360 273
361 274 $this->add_control(
@@ -361,78 +274,13 @@
361 274 $this->add_control(
362 275 'section_search_field_sub_heading',
363 276 [
364 277 'label' => __( 'Search Subheading', 'betterdocs' ),
365 - 'type' => Controls_Manager::TEXT,
366 - 'condition' => [
367 - 'layout_select' => 'layout-1',
368 - 'search_modal_layout' => 'layout-1'
369 - ],
370 - 'conditions' => [
371 - 'relation' => 'or',
372 - 'terms' => [
373 - [
374 - 'name' => 'layout_select',
375 - 'operator' => '==',
376 - 'value' => 'layout-1'
377 - ],
378 - [
379 - 'relation' => 'and',
380 - 'terms' => [
381 - [
382 - 'name' => 'layout_select',
383 - 'operator' => '==',
384 - 'value' => 'layout-2'
385 - ],
386 - [
387 - 'name' => 'search_modal_layout',
388 - 'operator' => '==',
389 - 'value' => 'layout-1'
390 - ]
391 - ]
392 - ]
393 - ]
394 - ]
278 + 'type' => Controls_Manager::TEXT
395 279 ]
396 280 );
397 281
398 282 $this->add_control(
399 - 'section_search_field_heading_tag',
400 - [
401 - 'label' => __( 'Heading Tag', 'betterdocs' ),
402 - 'type' => Controls_Manager::SELECT,
403 - 'default' => 'h1',
404 - 'options' => [
405 - 'h1' => 'H1',
406 - 'h2' => 'H2',
407 - 'h3' => 'H3',
408 - 'h4' => 'H4',
409 - 'h5' => 'H5',
410 - 'h6' => 'H6',
411 - 'p' => 'P'
412 - ]
413 - ]
414 - );
415 -
416 - $this->add_control(
417 - 'section_search_field_subheading_tag',
418 - [
419 - 'label' => __( 'Subheading Tag', 'betterdocs' ),
420 - 'type' => Controls_Manager::SELECT,
421 - 'default' => 'p',
422 - 'options' => [
423 - 'h1' => 'H1',
424 - 'h2' => 'H2',
425 - 'h3' => 'H3',
426 - 'h4' => 'H4',
427 - 'h5' => 'H5',
428 - 'h6' => 'H6',
429 - 'p' => 'P'
430 - ]
431 - ]
432 - );
433 -
434 - $this->add_control(
435 283 'betterdocs_search_button_toogle',
436 284 [
437 285 'label' => __( 'Enable Search Button', 'betterdocs' ),
438 286 'type' => Controls_Manager::SWITCHER,
@@ -442,314 +290,13 @@
442 290 'default' => true
443 291 ]
444 292 );
445 293
446 - $this->add_control(
447 - 'enable_ai_powered_search',
448 - [
449 - 'label' => __( 'AI-Powered Smart Modal Search', 'betterdocs' ),
450 - 'type' => Controls_Manager::SWITCHER,
451 - 'label_on' => __( 'On', 'betterdocs' ),
452 - 'label_off' => __( 'Off', 'betterdocs' ),
453 - 'return_value' => 'true',
454 - 'default' => false
455 - ]
456 - );
457 -
458 294 do_action( 'betterdocs/elementor/widgets/advanced-search/switcher', $this );
459 295
460 - // AI Search Suggestions filter
461 - apply_filters( 'betterdocs_search_form_ai_suggestions', '', $this );
462 -
463 296 $this->end_controls_section();
464 297 }
465 298
466 - public function ai_search_suggestions_controls() {
467 - // Check if AI Search Suggestions are available
468 - if ( ! betterdocs()->helper->is_ai_chatbot_enabled() ) {
469 - return;
470 - }
471 -
472 - $this->start_controls_section(
473 - 'ai_search_suggestions_section',
474 - [
475 - 'label' => __( 'AI-Powered Smart Modal Search', 'betterdocs' ),
476 - 'tab' => Controls_Manager::TAB_STYLE,
477 - 'condition' => [
478 - 'enable_ai_powered_search' => 'true',
479 - ],
480 - ]
481 - );
482 -
483 - $this->add_control(
484 - 'ai_suggestion_background_color',
485 - [
486 - 'label' => __( 'Background Color', 'betterdocs' ),
487 - 'type' => Controls_Manager::COLOR,
488 - 'selectors' => [
489 - '{{WRAPPER}} .betterdocs-ai-suggestion' => 'background-color: {{VALUE}};',
490 - ],
491 - 'condition' => [
492 - 'enable_ai_powered_search' => 'true',
493 - ],
494 - ]
495 - );
496 -
497 - $this->add_control(
498 - 'ai_suggestion_hover_background_color',
499 - [
500 - 'label' => __( 'Hover Background Color', 'betterdocs' ),
501 - 'type' => Controls_Manager::COLOR,
502 - 'selectors' => [
503 - '{{WRAPPER}} .betterdocs-ai-suggestion:hover' => 'background-color: {{VALUE}};',
504 - ],
505 - 'condition' => [
506 - 'enable_ai_powered_search' => 'true',
507 - ],
508 - ]
509 - );
510 -
511 - $this->add_responsive_control(
512 - 'ai_suggestion_margin',
513 - [
514 - 'label' => __( 'Margin', 'betterdocs' ),
515 - 'type' => Controls_Manager::DIMENSIONS,
516 - 'size_units' => [ 'px', '%', 'em' ],
517 - 'selectors' => [
518 - '{{WRAPPER}} .betterdocs-ai-suggestion' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
519 - ],
520 - 'condition' => [
521 - 'enable_ai_powered_search' => 'true',
522 - ],
523 - ]
524 - );
525 -
526 - $this->add_responsive_control(
527 - 'ai_suggestion_padding',
528 - [
529 - 'label' => __( 'Padding', 'betterdocs' ),
530 - 'type' => Controls_Manager::DIMENSIONS,
531 - 'size_units' => [ 'px', '%', 'em' ],
532 - 'selectors' => [
533 - '{{WRAPPER}} .betterdocs-ai-suggestion' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
534 - ],
535 - 'condition' => [
536 - 'enable_ai_powered_search' => 'true',
537 - ],
538 - ]
539 - );
540 -
541 - // Title Controls
542 - $this->add_control(
543 - 'ai_suggestion_title_heading',
544 - [
545 - 'label' => __( 'Title', 'betterdocs' ),
546 - 'type' => Controls_Manager::HEADING,
547 - 'separator' => 'before',
548 - 'condition' => [
549 - 'enable_ai_powered_search' => 'true',
550 - ],
551 - ]
552 - );
553 -
554 - $this->add_group_control(
555 - Group_Control_Typography::get_type(),
556 - [
557 - 'name' => 'ai_suggestion_title_typography',
558 - 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-suggestion-prompt .ai-suggestion-text .ai-suggestion-label, {{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-header .ai-response-title',
559 - 'condition' => [
560 - 'enable_ai_powered_search' => 'true',
561 - ],
562 - ]
563 - );
564 -
565 - $this->add_control(
566 - 'ai_suggestion_title_color',
567 - [
568 - 'label' => __( 'Title Color', 'betterdocs' ),
569 - 'type' => Controls_Manager::COLOR,
570 - 'selectors' => [
571 - '{{WRAPPER}} .betterdocs-ai-suggestion .ai-suggestion-prompt .ai-suggestion-text .ai-suggestion-label, , {{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-header .ai-response-title' => 'color: {{VALUE}};',
572 - ],
573 - 'condition' => [
574 - 'enable_ai_powered_search' => 'true',
575 - ],
576 - ]
577 - );
578 -
579 - // Query Controls
580 - $this->add_control(
581 - 'ai_suggestion_query_heading',
582 - [
583 - 'label' => __( 'Query', 'betterdocs' ),
584 - 'type' => Controls_Manager::HEADING,
585 - 'separator' => 'before',
586 - 'condition' => [
587 - 'enable_ai_powered_search' => 'true',
588 - ],
589 - ]
590 - );
591 -
592 - $this->add_group_control(
593 - Group_Control_Typography::get_type(),
594 - [
595 - 'name' => 'ai_suggestion_query_typography',
596 - 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-suggestion-prompt .ai-suggestion-content .ai-suggestion-query',
597 - 'condition' => [
598 - 'enable_ai_powered_search' => 'true',
599 - ],
600 - ]
601 - );
602 -
603 - $this->add_control(
604 - 'ai_suggestion_query_color',
605 - [
606 - 'label' => __( 'Query Text Color', 'betterdocs' ),
607 - 'type' => Controls_Manager::COLOR,
608 - 'selectors' => [
609 - '{{WRAPPER}} .betterdocs-ai-suggestion .ai-suggestion-prompt .ai-suggestion-content .ai-suggestion-query' => 'color: {{VALUE}};',
610 - ],
611 - 'condition' => [
612 - 'enable_ai_powered_search' => 'true',
613 - ],
614 - ]
615 - );
616 -
617 - // Response Controls
618 - $this->add_control(
619 - 'ai_suggestion_response_heading',
620 - [
621 - 'label' => __( 'Response', 'betterdocs' ),
622 - 'type' => Controls_Manager::HEADING,
623 - 'separator' => 'before',
624 - 'condition' => [
625 - 'enable_ai_powered_search' => 'true',
626 - ],
627 - ]
628 - );
629 -
630 - $this->add_group_control(
631 - Group_Control_Typography::get_type(),
632 - [
633 - 'name' => 'ai_suggestion_response_typography',
634 - 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response-content',
635 - 'condition' => [
636 - 'enable_ai_powered_search' => 'true',
637 - ],
638 - ]
639 - );
640 -
641 - $this->add_control(
642 - 'ai_suggestion_response_color',
643 - [
644 - 'label' => __( 'Response Text Color', 'betterdocs' ),
645 - 'type' => Controls_Manager::COLOR,
646 - 'selectors' => [
647 - '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response-content' => 'color: {{VALUE}};',
648 - ],
649 - 'condition' => [
650 - 'enable_ai_powered_search' => 'true',
651 - ],
652 - ]
653 - );
654 -
655 - // Button Controls
656 - $this->add_control(
657 - 'ai_suggestion_button_heading',
658 - [
659 - 'label' => __( 'Continue Chat Button', 'betterdocs' ),
660 - 'type' => Controls_Manager::HEADING,
661 - 'separator' => 'before',
662 - 'condition' => [
663 - 'enable_ai_powered_search' => 'true',
664 - ],
665 - ]
666 - );
667 -
668 - $this->add_group_control(
669 - Group_Control_Typography::get_type(),
670 - [
671 - 'name' => 'ai_suggestion_button_typography',
672 - 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn',
673 - 'condition' => [
674 - 'enable_ai_powered_search' => 'true',
675 - ],
676 - ]
677 - );
678 -
679 - $this->add_control(
680 - 'ai_suggestion_button_color',
681 - [
682 - 'label' => __( 'Button Text Color', 'betterdocs' ),
683 - 'type' => Controls_Manager::COLOR,
684 - 'selectors' => [
685 - '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn' => 'color: {{VALUE}};',
686 - ],
687 - 'condition' => [
688 - 'enable_ai_powered_search' => 'true',
689 - ],
690 - ]
691 - );
692 -
693 - $this->add_control(
694 - 'ai_suggestion_button_bg_color',
695 - [
696 - 'label' => __( 'Button Background Color', 'betterdocs' ),
697 - 'type' => Controls_Manager::COLOR,
698 - 'selectors' => [
699 - '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn' => 'background-color: {{VALUE}};',
700 - ],
701 - 'condition' => [
702 - 'enable_ai_powered_search' => 'true',
703 - ],
704 - ]
705 - );
706 -
707 - $this->add_responsive_control(
708 - 'ai_suggestion_button_padding',
709 - [
710 - 'label' => __( 'Button Padding', 'betterdocs' ),
711 - 'type' => Controls_Manager::DIMENSIONS,
712 - 'size_units' => [ 'px', '%', 'em' ],
713 - 'selectors' => [
714 - '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
715 - ],
716 - 'condition' => [
717 - 'enable_ai_powered_search' => 'true',
718 - ],
719 - ]
720 - );
721 -
722 - $this->add_responsive_control(
723 - 'ai_suggestion_button_margin',
724 - [
725 - 'label' => __( 'Button Margin', 'betterdocs' ),
726 - 'type' => Controls_Manager::DIMENSIONS,
727 - 'size_units' => [ 'px', '%', 'em' ],
728 - 'selectors' => [
729 - '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
730 - ],
731 - 'condition' => [
732 - 'enable_ai_powered_search' => 'true',
733 - ],
734 - ]
735 - );
736 -
737 - $this->add_group_control(
738 - Group_Control_Border::get_type(),
739 - [
740 - 'name' => 'ai_suggestion_button_border',
741 - 'label' => esc_html__( 'Button Border', 'betterdocs' ),
742 - 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn',
743 - 'condition' => [
744 - 'enable_ai_powered_search' => 'true',
745 - ],
746 - ]
747 - );
748 -
749 - $this->end_controls_section();
750 - }
751 -
752 299 public function search_box_layout_1() {
753 300 /**
754 301 * ----------------------------------------------------------
755 302 * Section: Search Box
@@ -825,10 +372,9 @@
825 372 [
826 373 'label' => __( 'Search Box', 'betterdocs' ),
827 374 'tab' => Controls_Manager::TAB_STYLE,
828 375 'condition' => [
829 - 'layout_select' => 'layout-2',
830 - 'search_modal_layout' => [ 'layout-1' ]
376 + 'layout_select' => 'layout-2'
831 377 ]
832 378 ]
833 379 );
834 380
@@ -1104,9 +650,9 @@
1104 650 [
1105 651 'label' => esc_html__( 'Field Background Color', 'betterdocs' ),
1106 652 'type' => Controls_Manager::COLOR,
1107 653 'selectors' => [
1108 - '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar, {{WRAPPER}} .betterdocs-search-form-widget-wrapper .betterdocs-live-search .betterdocs-searchform' => 'background: {{VALUE}};'
654 + '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'background: {{VALUE}};'
1109 655 ]
1110 656 ]
1111 657 );
1112 658
@@ -1115,9 +661,9 @@
1115 661 [
1116 662 'label' => esc_html__( 'Text Color', 'betterdocs' ),
1117 663 'type' => Controls_Manager::COLOR,
1118 664 'selectors' => [
1119 - '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-input, {{WRAPPER}} .betterdocs-search-form-widget-wrapper .betterdocs-live-search .betterdocs-searchform .betterdocs-searchform-input-wrap .betterdocs-search-command' => 'color: {{VALUE}};'
665 + '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-input' => 'color: {{VALUE}};'
1120 666 ]
1121 667 ]
1122 668 );
1123 669
@@ -1124,9 +670,9 @@
1124 670 $this->add_group_control(
1125 671 Group_Control_Typography::get_type(),
1126 672 [
1127 673 'name' => 'search_field_text_typography_layout_2',
1128 - 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-input,, {{WRAPPER}} .betterdocs-search-form-widget-wrapper .betterdocs-live-search .betterdocs-searchform .betterdocs-searchform-input-wrap .betterdocs-search-command'
674 + 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-input'
1129 675 ]
1130 676 );
1131 677
1132 678 $this->add_responsive_control(
@@ -1135,9 +681,9 @@
1135 681 'label' => __( 'Field Padding', 'betterdocs' ),
1136 682 'type' => Controls_Manager::DIMENSIONS,
1137 683 'size_units' => [ 'px', 'em', '%' ],
1138 684 'selectors' => [
1139 - '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar, {{WRAPPER}} .betterdocs-search-form-widget-wrapper .betterdocs-live-search .betterdocs-searchform' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
685 + '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1140 686 ]
1141 687 ]
1142 688 );
1143 689
@@ -1148,12 +694,8 @@
1148 694 'type' => Controls_Manager::DIMENSIONS,
1149 695 'size_units' => [ 'px', 'em', '%' ],
1150 696 'selectors' => [
1151 697 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1152 - ],
1153 - 'condition' => [
1154 - 'layout_select' => [ 'layout-2' ],
1155 - 'search_modal_layout' => [ 'layout-1' ]
1156 698 ]
1157 699 ]
1158 700 );
1159 701
@@ -1164,12 +706,8 @@
1164 706 'type' => Controls_Manager::DIMENSIONS,
1165 707 'size_units' => [ 'px', 'em', '%' ],
1166 708 'selectors' => [
1167 709 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1168 - ],
1169 - 'condition' => [
1170 - 'layout_select' => [ 'layout-2' ],
1171 - 'search_modal_layout' => [ 'layout-1' ]
1172 710 ]
1173 711 ]
1174 712 );
1175 713
@@ -1177,14 +715,10 @@
1177 715 Group_Control_Border::get_type(),
1178 716 [
1179 717 'name' => 'advanced_search_border_layout_2',
1180 718 'label' => esc_html__( 'Search Box Border', 'betterdocs' ),
1181 - 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar',
1182 - 'condition' => [
1183 - 'layout_select' => [ 'layout-2' ],
1184 - 'search_modal_layout' => [ 'layout-1' ]
1185 - ]
1186 - ],
719 + 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar'
720 + ]
1187 721 );
1188 722
1189 723 $this->add_control(
1190 724 'search_box_outer_width_layout_2',
@@ -1197,12 +731,8 @@
1197 731 'size' => 100
1198 732 ],
1199 733 'selectors' => [
1200 734 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
1201 - ],
1202 - 'condition' => [
1203 - 'layout_select' => [ 'layout-2' ],
1204 - 'search_modal_layout' => [ 'layout-1' ]
1205 735 ]
1206 736 ]
1207 737 );
1208 738
@@ -1213,12 +743,8 @@
1213 743 'type' => Controls_Manager::DIMENSIONS,
1214 744 'size_units' => [ 'px', 'em', '%' ],
1215 745 'selectors' => [
1216 746 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1217 - ],
1218 - 'condition' => [
1219 - 'layout_select' => [ 'layout-2' ],
1220 - 'search_modal_layout' => [ 'layout-1' ]
1221 747 ]
1222 748 ]
1223 749 );
1224 750
@@ -1236,9 +762,9 @@
1236 762 [
1237 763 'label' => esc_html__( 'Color', 'betterdocs' ),
1238 764 'type' => Controls_Manager::COLOR,
1239 765 'selectors' => [
1240 - '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-icon g path, {{WRAPPER}} .betterdocs-search-form-widget-wrapper .betterdocs-live-search .betterdocs-searchform .betterdocs-searchform-input-wrap svg path' => 'fill: {{VALUE}};'
766 + '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-icon g path' => 'fill: {{VALUE}};'
1241 767 ]
1242 768 ]
1243 769 );
1244 770
@@ -1253,9 +779,9 @@
1253 779 'max' => 500
1254 780 ]
1255 781 ],
1256 782 'selectors' => [
1257 - '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-icon, {{WRAPPER}} .betterdocs-search-form-widget-wrapper .betterdocs-live-search .betterdocs-searchform .betterdocs-searchform-input-wrap svg' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
783 + '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-icon' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
1258 784 ]
1259 785 ]
1260 786 );
1261 787
@@ -1273,9 +799,9 @@
1273 799 [
1274 800 'label' => esc_html__( 'Color', 'betterdocs' ),
1275 801 'type' => Controls_Manager::COLOR,
1276 802 'selectors' => [
1277 - '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button, {{WRAPPER}} .betterdocs-search-modal-archive .betterdocs-live-search .betterdocs-searchform .search-button' => 'color: {{VALUE}};'
803 + '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button' => 'color: {{VALUE}};'
1278 804 ]
1279 805 ]
1280 806 );
1281 807
@@ -1284,9 +810,9 @@
1284 810 [
1285 811 'label' => esc_html__( 'Background Color', 'betterdocs' ),
1286 812 'type' => Controls_Manager::COLOR,
1287 813 'selectors' => [
1288 - '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button, {{WRAPPER}} .betterdocs-search-modal-archive .betterdocs-live-search .betterdocs-searchform .search-button' => 'background-color: {{VALUE}};'
814 + '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button' => 'background-color: {{VALUE}};'
1289 815 ]
1290 816 ]
1291 817 );
1292 818
@@ -1296,9 +822,9 @@
1296 822 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
1297 823 'type' => Controls_Manager::DIMENSIONS,
1298 824 'size_units' => [ 'px', 'em', '%' ],
1299 825 'selectors' => [
1300 - '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button, {{WRAPPER}} .betterdocs-search-modal-archive .betterdocs-live-search .betterdocs-searchform .search-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
826 + '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1301 827 ]
1302 828 ]
1303 829 );
1304 830
@@ -1305,9 +831,9 @@
1305 831 $this->add_group_control(
1306 832 Group_Control_Typography::get_type(),
1307 833 [
1308 834 'name' => 'field_search_button_typography_layout_2',
1309 - 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button, {{WRAPPER}} .betterdocs-search-modal-archive .betterdocs-live-search .betterdocs-searchform .search-button'
835 + 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button'
1310 836 ]
1311 837 );
1312 838
1313 839 $this->end_controls_section(); # end of 'Search Field'
@@ -1328,9 +854,9 @@
1328 854 $this->add_control(
1329 855 'search_modal_field',
1330 856 [
1331 857 'label' => esc_html__( 'Search Field', 'betterdocs' ),
1332 - 'type' => Controls_Manager::HEADING,
858 + 'type' => \Elementor\Controls_Manager::HEADING,
1333 859 'separator' => 'before',
1334 860 ]
1335 861 );
1336 862
@@ -1350,9 +876,9 @@
1350 876 [
1351 877 'label' => esc_html__( 'Field Background Color', 'betterdocs' ),
1352 878 'type' => Controls_Manager::COLOR,
1353 879 'selectors' => [
1354 - '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header' => 'background-color: {{VALUE}};'
880 + '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap' => 'background-color: {{VALUE}};'
1355 881 ]
1356 882 ]
1357 883 );
1358 884
@@ -1366,9 +892,9 @@
1366 892
1367 893 $this->add_responsive_control(
1368 894 'search_modal_field_color',
1369 895 [
1370 - 'label' => esc_html__( 'Field Text Color', 'betterdocs' ),
896 + 'label' => esc_html__( 'Field Color', 'betterdocs' ),
1371 897 'type' => Controls_Manager::COLOR,
1372 898 'selectors' => [
1373 899 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap .betterdocs-search-field' => 'color: {{VALUE}};'
1374 900 ]
@@ -1389,9 +915,9 @@
1389 915 $this->add_control(
1390 916 'search_modal_category_section',
1391 917 [
1392 918 'label' => esc_html__( 'Search Category', 'betterdocs' ),
1393 - 'type' => Controls_Manager::HEADING,
919 + 'type' => \Elementor\Controls_Manager::HEADING,
1394 920 'separator' => 'before',
1395 921 ]
1396 922 );
1397 923
@@ -1417,9 +943,9 @@
1417 943 $this->add_control(
1418 944 'search_modal_content_tabs',
1419 945 [
1420 946 'label' => esc_html__( 'Content Tabs', 'betterdocs' ),
1421 - 'type' => Controls_Manager::HEADING,
947 + 'type' => \Elementor\Controls_Manager::HEADING,
1422 948 'separator' => 'before',
1423 949 ]
1424 950 );
1425 951
@@ -1477,9 +1003,9 @@
1477 1003 $this->add_control(
1478 1004 'search_modal_content_list',
1479 1005 [
1480 1006 'label' => esc_html__( 'Content List', 'betterdocs' ),
1481 - 'type' => Controls_Manager::HEADING,
1007 + 'type' => \Elementor\Controls_Manager::HEADING,
1482 1008 'separator' => 'before',
1483 1009 ]
1484 1010 );
1485 1011
@@ -1537,9 +1063,9 @@
1537 1063 $this->add_control(
1538 1064 'search_modal_content_list_category',
1539 1065 [
1540 1066 'label' => esc_html__( 'Content List Category', 'betterdocs' ),
1541 - 'type' => Controls_Manager::HEADING,
1067 + 'type' => \Elementor\Controls_Manager::HEADING,
1542 1068 'separator' => 'before',
1543 1069 ]
1544 1070 );
1545 1071
@@ -1869,10 +1395,8 @@
1869 1395 }
1870 1396
1871 1397 public function render_callback() {
1872 1398 $settings = &$this->attributes;
1873 -
1874 - // Always ensure content is output to prevent empty widget background
1875 1399 if ( $settings['layout_select'] == 'layout-1' ) {
1876 1400 $this->views( 'widgets/search-form' );
1877 1401 } else {
1878 1402 $number_of_docs = isset( $settings['initial_docs_number'] ) ? $settings['initial_docs_number'] : '';
@@ -1879,28 +1403,12 @@
1879 1403 $number_of_faqs = isset( $settings['initial_faqs_number'] ) ? $settings['initial_faqs_number'] : '';
1880 1404 $doc_categories_ids = isset( $settings['search_modal_query_term_ids'] ) ? $settings['search_modal_query_term_ids'] : '';
1881 1405 $doc_ids = isset( $settings['search_modal_query_doc_ids'] ) ? $settings['search_modal_query_doc_ids'] : '';
1882 1406 $faq_categories_ids = isset( $settings['search_modal_query_faq_term_ids'] ) ? $settings['search_modal_query_faq_term_ids'] : '';
1883 - $search_modal_layout = isset( $settings['search_modal_layout'] ) ? $settings['search_modal_layout'] : 'layout-1';
1884 - $search_modal_search_type = betterdocs()->settings->get('search_modal_search_type');
1885 -
1886 - // Ensure we always output content, especially in edit mode
1887 - echo '<div class="betterdocs-search-form-widget-wrapper">';
1888 - echo do_shortcode( '[betterdocs_search_modal enable_faq_search="'.($search_modal_search_type == 'all' || $search_modal_search_type == 'faq' ? true : false).'" enable_docs_search="'.($search_modal_search_type == 'all' || $search_modal_search_type == 'docs' ? true : false).'" faq_categories_ids="' . $faq_categories_ids . '" doc_ids="' . $doc_ids . '" doc_categories_ids="' . $doc_categories_ids . '" search_button="' . ( isset( $settings['betterdocs_search_button_toogle'] ) ? $settings['betterdocs_search_button_toogle'] : true ) . '" number_of_docs="' . $number_of_docs . '" number_of_faqs="' . $number_of_faqs . '" heading_tag="' . ( isset( $settings['section_search_field_heading_tag'] ) ? $settings['section_search_field_heading_tag'] : 'h2' ) . '" subheading_tag="' . ( isset( $settings['section_search_field_subheading_tag'] ) ? $settings['section_search_field_subheading_tag'] : 'h3' ) . '" search_button_text="Search" layout="' . $search_modal_layout . '" heading="' . ( isset( $settings['section_search_field_heading'] ) ? $settings['section_search_field_heading'] : '' ) . '" placeholder="' . ( isset( $settings['section_search_field_placeholder'] ) ? $settings['section_search_field_placeholder'] : '' ) . '" subheading="' . ( isset( $settings['section_search_field_sub_heading'] ) ? $settings['section_search_field_sub_heading'] : '' ) . '" category_search="' . ( isset( $settings['betterdocs_category_search_toogle'] ) ? $settings['betterdocs_category_search_toogle'] : false ) . '" popular_search="' . ( isset( $settings['betterdocs_popular_search_toogle'] ) ? $settings['betterdocs_popular_search_toogle'] : false ) . '" enable_ai_powered_search="' . ( isset( $settings['enable_ai_powered_search'] ) && $settings['enable_ai_powered_search'] === 'true' ? 'true' : 'false' ) . '"]' );
1889 - echo '</div>';
1407 + // $faq_terms = isset( $settings['include_faq'] ) ? implode(',', $settings['include_faq']) : '';
1408 + // $doc_terms = isset( $settings['include_doc_categories'] ) ? implode(',', $settings['include_doc_categories'] ) : '';
1409 + echo do_shortcode( '[betterdocs_search_modal faq_categories_ids="' . $faq_categories_ids . '" doc_ids="' . $doc_ids . '" doc_categories_ids="' . $doc_categories_ids . '" search_button="' . ( isset( $settings['betterdocs_search_button_toogle'] ) ? $settings['betterdocs_search_button_toogle'] : true ) . '" number_of_docs="' . $number_of_docs . '" number_of_faqs="' . $number_of_faqs . '" heading_tag="h2" subheading_tag="h3" search_button_text="Search" layout="layout-1" heading="' . ( isset( $settings['section_search_field_heading'] ) ? $settings['section_search_field_heading'] : '' ) . '" placeholder="' . ( isset( $settings['section_search_field_placeholder'] ) ? $settings['section_search_field_placeholder'] : '' ) . '" subheading="' . ( isset( $settings['section_search_field_sub_heading'] ) ? $settings['section_search_field_sub_heading'] : '' ) . '" category_search="' . ( isset( $settings['betterdocs_category_search_toogle'] ) ? $settings['betterdocs_category_search_toogle'] : false ) . '" popular_search="' . ( isset( $settings['betterdocs_popular_search_toogle'] ) ? $settings['betterdocs_popular_search_toogle'] : false ) . '"]' );
1890 1410 }
1891 -
1892 - // Add editor-specific styles to prevent empty widget background
1893 - if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
1894 - echo '<style>
1895 - .elementor-widget-betterdocs-search-form {
1896 - background-color: transparent !important;
1897 - }
1898 - .elementor-widget-betterdocs-search-form .elementor-widget-container {
1899 - min-height: 50px;
1900 - }
1901 - </style>';
1902 - }
1903 1411 }
1904 1412
1905 1413 public function view_params() {
1906 1414 $settings = &$this->attributes;
@@ -1919,10 +1427,8 @@
1919 1427 'search_button' => $search_button_toggle,
1920 1428 'popular_search' => $popular_search_toggle,
1921 1429 'heading' => esc_html( $settings['section_search_field_heading'] ),
1922 1430 'subheading' => esc_html( $settings['section_search_field_sub_heading'] ),
1923 - 'heading_tag' => esc_attr( $settings['section_search_field_heading_tag'] ),
1924 - 'subheading_tag' => esc_attr( $settings['section_search_field_subheading_tag'] ),
1925 1431 'placeholder' => esc_html( $settings['section_search_field_placeholder'] )
1926 1432 ],
1927 1433 $this->attributes
1928 1434 );
@@ -1929,13 +1435,8 @@
1929 1435
1930 1436 return [
1931 1437 'shortcode_attr' => $_shortcode_attributes
1932 1438 ];
1933 - }
1934 -
1935 - // Prevent empty widget background in Elementor
1936 - protected function should_print_empty() {
1937 - return false;
1938 1439 }
1939 1440
1940 1441 // In plain mode, render without shortcode
1941 1442 public function render_plain_content() {