PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.2.6
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.2.6
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 3.5.2 All 199 releases
betterdocs / includes / Editors / Elementor / Widget / Basic / SearchForm.php

SearchForm.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.2.6, at includes/Editors/Elementor/Widget/Basic/SearchForm.php

1,992 lines 58.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WPDeveloper\BetterDocs\Editors\Elementor\Widget\Basic;
3
4 // If this file is called directly, abort.
5 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 use Elementor\Group_Control_Background;
10 use Elementor\Controls_Manager;
11 use WPDeveloper\BetterDocs\Editors\Elementor\BaseWidget;
12 use Elementor\Group_Control_Border;
13 use Elementor\Group_Control_Typography;
14
15 class SearchForm extends BaseWidget {
16 public $view_wrapper = 'betterdocs-search-form-wrapper';
17
18 public function get_name() {
19 return 'betterdocs-search-form';
20 }
21
22 public function get_title() {
23 return __( 'BetterDocs Search Form', 'betterdocs' );
24 }
25
26 public function get_categories() {
27 return [ 'betterdocs-elements', 'docs-archive', 'betterdocs-elements-single' ];
28 }
29
30 public function get_icon() {
31 return 'betterdocs-icon-search';
32 }
33
34 public function get_style_depends() {
35 return [ 'betterdocs-search', 'betterdocs-search-modal' ];
36 }
37
38 public function get_script_depends() {
39 return [ 'betterdocs-search', 'betterdocs-pro', 'betterdocs-search-modal', 'betterdocs-category-grid', 'betterdocs-extend-search-modal' ];
40 }
41
42 /**
43 * Get widget keywords.
44 *
45 * Retrieve the list of keywords the widget belongs to.
46 *
47 * @return array Widget keywords.
48 * @since 3.5.2
49 * @access public
50 *
51 */
52 public function get_keywords() {
53 return [
54 'knowledgebase',
55 'knowledge Base',
56 'documentation',
57 'doc',
58 'kb',
59 'betterdocs',
60 'search',
61 'search form'
62
63 ];
64 }
65
66 public function get_custom_help_url() {
67 return 'https://betterdocs.co/docs/single-doc-in-elementor';
68 }
69
70 protected function register_controls() {
71 $this->layout_selection();
72 $this->search_modal_query();
73 $this->search_content_settings();
74 $this->search_box_layout_1();
75 $this->search_field_layout_1();
76 $this->search_result_box_layout_1();
77 $this->search_result_list_layout_1();
78
79 $this->search_box_layout_2();
80 $this->search_field_layout_2();
81 $this->ai_search_suggestions_controls();
82 $this->search_modal_layout();
83 }
84
85 public function layout_selection() {
86 $this->start_controls_section(
87 'layout_selection_section',
88 [
89 'label' => __( 'Search Layout', 'betterdocs' ),
90 'tab' => Controls_Manager::TAB_CONTENT
91 ]
92 );
93
94 $this->add_control(
95 'layout_select',
96 [
97 'label' => esc_html__( 'Select layout', 'betterdocs' ),
98 'type' => Controls_Manager::SELECT,
99 'default' => 'layout-2',
100 'label_block' => false,
101 'options' => [
102 'layout-1' => esc_html__( 'Classic Layout', 'betterdocs' ),
103 'layout-2' => esc_html__( 'Modal Layout', 'betterdocs' )
104 ]
105 ]
106 );
107
108 $this->add_control(
109 'search_modal_layout',
110 [
111 'label' => __( 'Search Modal Layout', 'betterdocs' ),
112 'type' => Controls_Manager::SELECT,
113 'default' => 'layout-1',
114 'label_block' => false,
115 'options' => [
116 'layout-1' => esc_html__( 'Layout 1', 'betterdocs' ),
117 'docs-archive' => esc_html__( 'Layout 2', 'betterdocs' ),
118 'sidebar' => esc_html__( 'Layout 3', 'betterdocs' )
119 ],
120 'condition' => [
121 'layout_select' => [ 'layout-2' ]
122 ]
123 ]
124 );
125
126 $this->add_control(
127 'search_modal_width',
128 [
129 'label' => __( 'Width', 'betterdocs' ),
130 'type' => Controls_Manager::SLIDER,
131 'size_units' => [ '%', 'px' ],
132 'range' => [
133 '%' => [
134 'min' => 10,
135 'max' => 100,
136 ],
137 'px' => [
138 'min' => 100,
139 'max' => 1200,
140 ],
141 ],
142 'default' => [
143 'unit' => '%',
144 'size' => 100,
145 ],
146 'selectors' => [
147 '{{WRAPPER}} .betterdocs-search-modal-archive' => 'width: {{SIZE}}{{UNIT}};max-width: 100%;',
148 '{{WRAPPER}} .betterdocs-search-modal-sidebar' => 'width: {{SIZE}}{{UNIT}};',
149 ],
150 'condition' => [
151 'layout_select' => [ 'layout-2' ],
152 'search_modal_layout' => [ 'docs-archive', 'sidebar' ]
153 ]
154 ]
155 );
156
157 $this->add_control(
158 'search_modal_position',
159 [
160 'label' => __( 'Position', 'betterdocs' ),
161 'type' => Controls_Manager::SELECT,
162 'default' => 'left',
163 'options' => [
164 'left' => __( 'Left', 'betterdocs' ),
165 'right' => __( 'Right', 'betterdocs' ),
166 ],
167 'selectors' => [
168 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
169 '{{WRAPPER}} .betterdocs-search-modal-archive' => 'display: inline-block; text-align: left;',
170 '{{WRAPPER}} .betterdocs-search-modal-sidebar' => 'display: inline-block; text-align: left;',
171 ],
172 'condition' => [
173 'layout_select' => [ 'layout-2' ],
174 'search_modal_layout' => [ 'docs-archive', 'sidebar' ]
175 ]
176 ]
177 );
178
179 $this->end_controls_section();
180 }
181
182 public function search_modal_query() {
183 $this->start_controls_section(
184 'search_modal_query',
185 [
186 'label' => __( 'Modal Query', 'betterdocs' ),
187 'condition' => [
188 'layout_select' => [ 'layout-2' ]
189 ]
190 ]
191 );
192
193 $this->add_control(
194 'search_modal_layout',
195 [
196 'label' => __( 'Search Modal Layout', 'betterdocs' ),
197 'type' => Controls_Manager::SELECT,
198 'default' => 'layout-1',
199 'label_block' => false,
200 'options' => [
201 'layout-1' => esc_html__( 'Layout 1', 'betterdocs' ),
202 'docs-archive' => esc_html__( 'Layout 2', 'betterdocs' ),
203 'sidebar' => esc_html__( 'Layout 3', 'betterdocs' )
204 ]
205 ]
206 );
207
208 // $this->add_control(
209 // 'include_doc_categories',
210 // [
211 // 'label' => __( 'Doc Categories', 'betterdocs' ),
212 // 'label_block' => true,
213 // 'type' => Controls_Manager::SELECT2,
214 // 'options' => array_reduce( get_terms( ['taxonomy' => 'doc_category', 'hide_empty' => true] ), [$this, 'return_mod_terms'] ),
215 // 'multiple' => true,
216 // 'default' => []
217 // ]
218 // );
219
220 // $this->add_control(
221 // 'include_faq',
222 // [
223 // 'label' => __( 'FAQ', 'betterdocs' ),
224 // 'label_block' => true,
225 // 'type' => Controls_Manager::SELECT2,
226 // 'options' => array_reduce( get_terms(['taxonomy' => 'betterdocs_faq_category']), [$this, 'return_mod_terms'] ),
227 // 'multiple' => true,
228 // 'default' => []
229 // ]
230 // );
231
232 $this->add_control(
233 'search_modal_doc_query_type',
234 [
235 'label' => __( 'Select Docs Type', 'betterdocs' ),
236 'label_block' => true,
237 'type' => Controls_Manager::SELECT2,
238 'options' => [
239 'popular_docs' => __( 'Popular Docs', 'betterdocs' ),
240 'specific_doc_ids' => __( "Specific Doc Id's", 'betterdocs' ),
241 'specific_doc_term_ids' => __( "Specific Doc Term Id's", 'betterdocs' )
242 ],
243 'multiple' => false,
244 'default' => 'popular_docs'
245 ]
246 );
247
248 $this->add_control(
249 'search_modal_query_term_ids',
250 [
251 'label' => __( "Doc Term ID's", 'betterdocs' ),
252 'type' => Controls_Manager::TEXT,
253 'description' => __( 'Example: 8, 9', 'betterdocs' ),
254 'default' => '',
255 'condition' => [
256 'search_modal_doc_query_type' => 'specific_doc_term_ids'
257 ]
258 ]
259 );
260
261 $this->add_control(
262 'search_modal_query_doc_ids',
263 [
264 'label' => __( "Doc ID's", 'betterdocs' ),
265 'type' => Controls_Manager::TEXT,
266 'description' => __( 'Example: 15, 16', 'betterdocs' ),
267 'default' => '',
268 'condition' => [
269 'search_modal_doc_query_type' => 'specific_doc_ids'
270 ]
271 ]
272 );
273
274 $this->add_control(
275 'initial_docs_number',
276 [
277 'label' => __( 'Number of Docs', 'betterdocs' ),
278 'type' => Controls_Manager::NUMBER,
279 'default' => '5',
280 'condition' => [
281 'search_modal_doc_query_type' => 'popular_docs'
282 ]
283 ]
284 );
285
286 $this->add_control(
287 'search_modal_faq_query_type',
288 [
289 'label' => __( 'Select FAQ Type', 'betterdocs' ),
290 'label_block' => true,
291 'type' => Controls_Manager::SELECT2,
292 'default' => 'default',
293 'options' => [
294 'default' => __( 'Default', 'betterdocs' ),
295 'specific_faq_term_ids' => __( "Specific FAQ Term Id's", 'betterdocs' ),
296 ],
297 'multiple' => false,
298 ]
299 );
300
301 $this->add_control(
302 'search_modal_query_faq_term_ids',
303 [
304 'label' => __( "FAQ Term ID's", 'betterdocs' ),
305 'type' => Controls_Manager::TEXT,
306 'description' => __( 'Example: 8, 9', 'betterdocs' ),
307 'default' => '',
308 'condition' => [
309 'search_modal_faq_query_type' => 'specific_faq_term_ids'
310 ]
311 ]
312 );
313
314 $this->add_control(
315 'initial_faqs_number',
316 [
317 'label' => __( "Number of FAQ's", 'betterdocs' ),
318 'type' => Controls_Manager::NUMBER,
319 'default' => '5',
320 'condition' => [
321 'search_modal_faq_query_type' => 'default'
322 ]
323 ]
324 );
325
326 $this->end_controls_section();
327 }
328
329
330
331 public function return_mod_terms( $accumulator, $term ) {
332 $accumulator[ $term->term_id ] = htmlspecialchars_decode( $term->name );
333 return $accumulator;
334 }
335
336
337 public function search_content_settings() {
338 $this->start_controls_section(
339 'search_content_placeholders',
340 [
341 'label' => __( 'Search Content', 'betterdocs' ),
342 'tab' => Controls_Manager::TAB_CONTENT
343 ]
344 );
345
346 $this->add_control(
347 'section_search_field_placeholder',
348 [
349 'label' => __( 'Placeholder', 'betterdocs' ),
350 'type' => Controls_Manager::TEXT,
351 'default' => esc_html__( 'Search', 'betterdocs' )
352 ]
353 );
354
355 $this->add_control(
356 'section_search_field_heading',
357 [
358 'label' => __( 'Search Heading', 'betterdocs' ),
359 'type' => Controls_Manager::TEXT,
360 'condition' => [
361 'layout_select' => 'layout-1',
362 'search_modal_layout' => 'layout-1'
363 ],
364 'conditions' => [
365 'relation' => 'or',
366 'terms' => [
367 [
368 'name' => 'layout_select',
369 'operator' => '==',
370 'value' => 'layout-1'
371 ],
372 [
373 'relation' => 'and',
374 'terms' => [
375 [
376 'name' => 'layout_select',
377 'operator' => '==',
378 'value' => 'layout-2'
379 ],
380 [
381 'name' => 'search_modal_layout',
382 'operator' => '==',
383 'value' => 'layout-1'
384 ]
385 ]
386 ]
387 ]
388 ]
389 ]
390 );
391
392 $this->add_control(
393 'section_search_field_sub_heading',
394 [
395 'label' => __( 'Search Subheading', 'betterdocs' ),
396 'type' => Controls_Manager::TEXT,
397 'condition' => [
398 'layout_select' => 'layout-1',
399 'search_modal_layout' => 'layout-1'
400 ],
401 'conditions' => [
402 'relation' => 'or',
403 'terms' => [
404 [
405 'name' => 'layout_select',
406 'operator' => '==',
407 'value' => 'layout-1'
408 ],
409 [
410 'relation' => 'and',
411 'terms' => [
412 [
413 'name' => 'layout_select',
414 'operator' => '==',
415 'value' => 'layout-2'
416 ],
417 [
418 'name' => 'search_modal_layout',
419 'operator' => '==',
420 'value' => 'layout-1'
421 ]
422 ]
423 ]
424 ]
425 ]
426 ]
427 );
428
429 $this->add_control(
430 'section_search_field_heading_tag',
431 [
432 'label' => __( 'Heading Tag', 'betterdocs' ),
433 'type' => Controls_Manager::SELECT,
434 'default' => 'h1',
435 'options' => [
436 'h1' => 'H1',
437 'h2' => 'H2',
438 'h3' => 'H3',
439 'h4' => 'H4',
440 'h5' => 'H5',
441 'h6' => 'H6',
442 'p' => 'P'
443 ]
444 ]
445 );
446
447 $this->add_control(
448 'section_search_field_subheading_tag',
449 [
450 'label' => __( 'Subheading Tag', 'betterdocs' ),
451 'type' => Controls_Manager::SELECT,
452 'default' => 'p',
453 'options' => [
454 'h1' => 'H1',
455 'h2' => 'H2',
456 'h3' => 'H3',
457 'h4' => 'H4',
458 'h5' => 'H5',
459 'h6' => 'H6',
460 'p' => 'P'
461 ]
462 ]
463 );
464
465 $this->add_control(
466 'betterdocs_search_button_toogle',
467 [
468 'label' => __( 'Enable Search Button', 'betterdocs' ),
469 'type' => Controls_Manager::SWITCHER,
470 'label_on' => __( 'On', 'betterdocs' ),
471 'label_off' => __( 'Off', 'betterdocs' ),
472 'return_value' => 'true',
473 'default' => true
474 ]
475 );
476
477 $this->add_control(
478 'enable_ai_powered_search',
479 [
480 'label' => __( 'AI-Powered Smart Modal Search', 'betterdocs' ),
481 'type' => Controls_Manager::SWITCHER,
482 'label_on' => __( 'On', 'betterdocs' ),
483 'label_off' => __( 'Off', 'betterdocs' ),
484 'return_value' => 'true',
485 'default' => false
486 ]
487 );
488
489 do_action( 'betterdocs/elementor/widgets/advanced-search/switcher', $this );
490
491 // AI Search Suggestions filter
492 apply_filters( 'betterdocs_search_form_ai_suggestions', '', $this );
493
494 $this->end_controls_section();
495 }
496
497 public function ai_search_suggestions_controls() {
498 // Check if AI Search Suggestions are available
499 if ( ! betterdocs()->helper->is_ai_chatbot_enabled() ) {
500 return;
501 }
502
503 $this->start_controls_section(
504 'ai_search_suggestions_section',
505 [
506 'label' => __( 'AI-Powered Smart Modal Search', 'betterdocs' ),
507 'tab' => Controls_Manager::TAB_STYLE,
508 'condition' => [
509 'enable_ai_powered_search' => 'true',
510 ],
511 ]
512 );
513
514 $this->add_control(
515 'enable_ai_powered_search',
516 [
517 'label' => __( 'AI-Powered Smart Modal Search', 'betterdocs' ),
518 'type' => Controls_Manager::SWITCHER,
519 'label_on' => __( 'On', 'betterdocs' ),
520 'label_off' => __( 'Off', 'betterdocs' ),
521 'return_value' => 'true',
522 'default' => false,
523 'condition' => [
524 'enable_ai_powered_search' => 'true',
525 ],
526 ]
527 );
528
529 $this->add_control(
530 'ai_suggestion_background_color',
531 [
532 'label' => __( 'Background Color', 'betterdocs' ),
533 'type' => Controls_Manager::COLOR,
534 'selectors' => [
535 '{{WRAPPER}} .betterdocs-ai-suggestion' => 'background-color: {{VALUE}};',
536 ],
537 'condition' => [
538 'enable_ai_powered_search' => 'true',
539 ],
540 ]
541 );
542
543 $this->add_control(
544 'ai_suggestion_hover_background_color',
545 [
546 'label' => __( 'Hover Background Color', 'betterdocs' ),
547 'type' => Controls_Manager::COLOR,
548 'selectors' => [
549 '{{WRAPPER}} .betterdocs-ai-suggestion:hover' => 'background-color: {{VALUE}};',
550 ],
551 'condition' => [
552 'enable_ai_powered_search' => 'true',
553 ],
554 ]
555 );
556
557 $this->add_responsive_control(
558 'ai_suggestion_margin',
559 [
560 'label' => __( 'Margin', 'betterdocs' ),
561 'type' => Controls_Manager::DIMENSIONS,
562 'size_units' => [ 'px', '%', 'em' ],
563 'selectors' => [
564 '{{WRAPPER}} .betterdocs-ai-suggestion' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
565 ],
566 'condition' => [
567 'enable_ai_powered_search' => 'true',
568 ],
569 ]
570 );
571
572 $this->add_responsive_control(
573 'ai_suggestion_padding',
574 [
575 'label' => __( 'Padding', 'betterdocs' ),
576 'type' => Controls_Manager::DIMENSIONS,
577 'size_units' => [ 'px', '%', 'em' ],
578 'selectors' => [
579 '{{WRAPPER}} .betterdocs-ai-suggestion' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
580 ],
581 'condition' => [
582 'enable_ai_powered_search' => 'true',
583 ],
584 ]
585 );
586
587 // Title Controls
588 $this->add_control(
589 'ai_suggestion_title_heading',
590 [
591 'label' => __( 'Title', 'betterdocs' ),
592 'type' => Controls_Manager::HEADING,
593 'separator' => 'before',
594 'condition' => [
595 'enable_ai_powered_search' => 'true',
596 ],
597 ]
598 );
599
600 $this->add_group_control(
601 Group_Control_Typography::get_type(),
602 [
603 'name' => 'ai_suggestion_title_typography',
604 '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',
605 'condition' => [
606 'enable_ai_powered_search' => 'true',
607 ],
608 ]
609 );
610
611 $this->add_control(
612 'ai_suggestion_title_color',
613 [
614 'label' => __( 'Title Color', 'betterdocs' ),
615 'type' => Controls_Manager::COLOR,
616 'selectors' => [
617 '{{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}};',
618 ],
619 'condition' => [
620 'enable_ai_powered_search' => 'true',
621 ],
622 ]
623 );
624
625 // Query Controls
626 $this->add_control(
627 'ai_suggestion_query_heading',
628 [
629 'label' => __( 'Query', 'betterdocs' ),
630 'type' => Controls_Manager::HEADING,
631 'separator' => 'before',
632 'condition' => [
633 'enable_ai_powered_search' => 'true',
634 ],
635 ]
636 );
637
638 $this->add_group_control(
639 Group_Control_Typography::get_type(),
640 [
641 'name' => 'ai_suggestion_query_typography',
642 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-suggestion-prompt .ai-suggestion-content .ai-suggestion-query',
643 'condition' => [
644 'enable_ai_powered_search' => 'true',
645 ],
646 ]
647 );
648
649 $this->add_control(
650 'ai_suggestion_query_color',
651 [
652 'label' => __( 'Query Text Color', 'betterdocs' ),
653 'type' => Controls_Manager::COLOR,
654 'selectors' => [
655 '{{WRAPPER}} .betterdocs-ai-suggestion .ai-suggestion-prompt .ai-suggestion-content .ai-suggestion-query' => 'color: {{VALUE}};',
656 ],
657 'condition' => [
658 'enable_ai_powered_search' => 'true',
659 ],
660 ]
661 );
662
663 // Response Controls
664 $this->add_control(
665 'ai_suggestion_response_heading',
666 [
667 'label' => __( 'Response', 'betterdocs' ),
668 'type' => Controls_Manager::HEADING,
669 'separator' => 'before',
670 'condition' => [
671 'enable_ai_powered_search' => 'true',
672 ],
673 ]
674 );
675
676 $this->add_group_control(
677 Group_Control_Typography::get_type(),
678 [
679 'name' => 'ai_suggestion_response_typography',
680 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response-content',
681 'condition' => [
682 'enable_ai_powered_search' => 'true',
683 ],
684 ]
685 );
686
687 $this->add_control(
688 'ai_suggestion_response_color',
689 [
690 'label' => __( 'Response Text Color', 'betterdocs' ),
691 'type' => Controls_Manager::COLOR,
692 'selectors' => [
693 '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response-content' => 'color: {{VALUE}};',
694 ],
695 'condition' => [
696 'enable_ai_powered_search' => 'true',
697 ],
698 ]
699 );
700
701 // Button Controls
702 $this->add_control(
703 'ai_suggestion_button_heading',
704 [
705 'label' => __( 'Continue Chat Button', 'betterdocs' ),
706 'type' => Controls_Manager::HEADING,
707 'separator' => 'before',
708 'condition' => [
709 'enable_ai_powered_search' => 'true',
710 ],
711 ]
712 );
713
714 $this->add_group_control(
715 Group_Control_Typography::get_type(),
716 [
717 'name' => 'ai_suggestion_button_typography',
718 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn',
719 'condition' => [
720 'enable_ai_powered_search' => 'true',
721 ],
722 ]
723 );
724
725 $this->add_control(
726 'ai_suggestion_button_color',
727 [
728 'label' => __( 'Button Text Color', 'betterdocs' ),
729 'type' => Controls_Manager::COLOR,
730 'selectors' => [
731 '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn' => 'color: {{VALUE}};',
732 ],
733 'condition' => [
734 'enable_ai_powered_search' => 'true',
735 ],
736 ]
737 );
738
739 $this->add_control(
740 'ai_suggestion_button_bg_color',
741 [
742 'label' => __( 'Button Background Color', 'betterdocs' ),
743 'type' => Controls_Manager::COLOR,
744 'selectors' => [
745 '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn' => 'background-color: {{VALUE}};',
746 ],
747 'condition' => [
748 'enable_ai_powered_search' => 'true',
749 ],
750 ]
751 );
752
753 $this->add_responsive_control(
754 'ai_suggestion_button_padding',
755 [
756 'label' => __( 'Button Padding', 'betterdocs' ),
757 'type' => Controls_Manager::DIMENSIONS,
758 'size_units' => [ 'px', '%', 'em' ],
759 'selectors' => [
760 '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
761 ],
762 'condition' => [
763 'enable_ai_powered_search' => 'true',
764 ],
765 ]
766 );
767
768 $this->add_responsive_control(
769 'ai_suggestion_button_margin',
770 [
771 'label' => __( 'Button Margin', 'betterdocs' ),
772 'type' => Controls_Manager::DIMENSIONS,
773 'size_units' => [ 'px', '%', 'em' ],
774 'selectors' => [
775 '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
776 ],
777 'condition' => [
778 'enable_ai_powered_search' => 'true',
779 ],
780 ]
781 );
782
783 $this->add_group_control(
784 Group_Control_Border::get_type(),
785 [
786 'name' => 'ai_suggestion_button_border',
787 'label' => esc_html__( 'Button Border', 'betterdocs' ),
788 'selector' => '{{WRAPPER}} .betterdocs-ai-suggestion .ai-response .ai-response-actions .continue-conversation-btn',
789 'condition' => [
790 'enable_ai_powered_search' => 'true',
791 ],
792 ]
793 );
794
795 $this->end_controls_section();
796 }
797
798 public function search_box_layout_1() {
799 /**
800 * ----------------------------------------------------------
801 * Section: Search Box
802 * ----------------------------------------------------------
803 */
804 $this->start_controls_section(
805 'section_search_box_settings',
806 [
807 'label' => __( 'Search Box', 'betterdocs' ),
808 'tab' => Controls_Manager::TAB_STYLE,
809 'condition' => [
810 'layout_select' => 'layout-1'
811 ]
812 ]
813 );
814
815 $this->add_group_control(
816 Group_Control_Background::get_type(),
817 [
818 'name' => 'search_box_bg',
819 'types' => [ 'classic', 'gradient' ],
820 'selector' => '{{WRAPPER}} .betterdocs-search-form-wrapper'
821 ]
822 );
823
824 $this->add_responsive_control(
825 'search_box_padding',
826 [
827 'label' => esc_html__( 'Padding', 'betterdocs' ),
828 'type' => Controls_Manager::DIMENSIONS,
829 'size_units' => [ 'px', 'em', '%' ],
830 'default' => [
831 'top' => 50,
832 'right' => 50,
833 'bottom' => 50,
834 'left' => 50
835 ],
836 'selectors' => [
837 '{{WRAPPER}} .betterdocs-search-form-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
838 ]
839 ]
840 );
841
842 $this->add_responsive_control(
843 'search_box_margin',
844 [
845 'label' => esc_html__( 'Margin', 'betterdocs' ),
846 'type' => Controls_Manager::DIMENSIONS,
847 'size_units' => [ 'px', 'em', '%' ],
848 'default' => [
849 'top' => 50,
850 'right' => 50,
851 'bottom' => 50,
852 'left' => 50
853 ],
854 'selectors' => [
855 '{{WRAPPER}} .betterdocs-search-form-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
856 ]
857 ]
858 );
859
860 $this->end_controls_section(); # end of 'Search Box'
861 }
862
863 public function search_box_layout_2() {
864 /**
865 * ----------------------------------------------------------
866 * Section: Search Box
867 * ----------------------------------------------------------
868 */
869 $this->start_controls_section(
870 'section_search_box_settings_layout_2',
871 [
872 'label' => __( 'Search Box', 'betterdocs' ),
873 'tab' => Controls_Manager::TAB_STYLE,
874 'condition' => [
875 'layout_select' => 'layout-2',
876 'search_modal_layout' => [ 'layout-1' ]
877 ]
878 ]
879 );
880
881 $this->add_group_control(
882 Group_Control_Background::get_type(),
883 [
884 'name' => 'search_box_bg_layout_2',
885 'types' => [ 'classic', 'gradient' ],
886 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1'
887 ]
888 );
889
890 $this->add_responsive_control(
891 'search_box_padding_layout_2',
892 [
893 'label' => esc_html__( 'Padding', 'betterdocs' ),
894 'type' => Controls_Manager::DIMENSIONS,
895 'size_units' => [ 'px', 'em', '%' ],
896 'default' => [
897 'top' => 50,
898 'right' => 50,
899 'bottom' => 50,
900 'left' => 50
901 ],
902 'selectors' => [
903 '{{WRAPPER}} .betterdocs-search-layout-1' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
904 ]
905 ]
906 );
907
908 $this->add_responsive_control(
909 'search_box_margin_layout_2',
910 [
911 'label' => esc_html__( 'Margin', 'betterdocs' ),
912 'type' => Controls_Manager::DIMENSIONS,
913 'size_units' => [ 'px', 'em', '%' ],
914 'default' => [
915 'top' => 50,
916 'right' => 50,
917 'bottom' => 50,
918 'left' => 50
919 ],
920 'selectors' => [
921 '{{WRAPPER}} .betterdocs-search-layout-1' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
922 ]
923 ]
924 );
925
926 $this->end_controls_section(); # end of 'Search Box'
927 }
928
929 public function search_field_layout_1() {
930 /**
931 * ----------------------------------------------------------
932 * Section: Search Field
933 * ----------------------------------------------------------
934 */
935 $this->start_controls_section(
936 'section_search_field_settings',
937 [
938 'label' => __( 'Search Field', 'betterdocs' ),
939 'tab' => Controls_Manager::TAB_STYLE,
940 'condition' => [
941 'layout_select' => 'layout-1'
942 ]
943 ]
944 );
945
946 $this->add_control(
947 'search_field_bg',
948 [
949 'label' => esc_html__( 'Field Background Color', 'betterdocs' ),
950 'type' => Controls_Manager::COLOR,
951 'selectors' => [
952 '{{WRAPPER}} .betterdocs-searchform' => 'background: {{VALUE}};'
953 ]
954 ]
955 );
956
957 $this->add_control(
958 'search_field_text_color',
959 [
960 'label' => esc_html__( 'Text Color', 'betterdocs' ),
961 'type' => Controls_Manager::COLOR,
962 'selectors' => [
963 '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field' => 'color: {{VALUE}};'
964 ]
965 ]
966 );
967
968 $this->add_group_control(
969 Group_Control_Typography::get_type(),
970 [
971 'name' => 'search_field_text_typography',
972 'selector' => '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field'
973 ]
974 );
975
976 $this->add_responsive_control(
977 'search_field_padding',
978 [
979 'label' => __( 'Field Padding', 'betterdocs' ),
980 'type' => Controls_Manager::DIMENSIONS,
981 'size_units' => [ 'px', 'em', '%' ],
982 'selectors' => [
983 '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
984 ]
985 ]
986 );
987
988 $this->add_control(
989 'search_field_placeholder',
990 [
991 'label' => esc_html__( 'Field Placeholder Color', 'betterdocs' ),
992 'type' => Controls_Manager::COLOR,
993 'selectors' => [
994 '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field::placeholder' => 'color: {{VALUE}};'
995 ]
996 ]
997 );
998
999 $this->add_responsive_control(
1000 'search_box_outer_margin',
1001 [
1002 'label' => __( 'Search Box Margin', 'betterdocs' ),
1003 'type' => Controls_Manager::DIMENSIONS,
1004 'size_units' => [ 'px', 'em', '%' ],
1005 'selectors' => [
1006 '{{WRAPPER}} .betterdocs-searchform' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1007 ]
1008 ]
1009 );
1010
1011 $this->add_responsive_control(
1012 'advanced_search_padding',
1013 [
1014 'label' => __( 'Search Box Padding', 'betterdocs' ),
1015 'type' => Controls_Manager::DIMENSIONS,
1016 'size_units' => [ 'px', 'em', '%' ],
1017 'selectors' => [
1018 '{{WRAPPER}} .betterdocs-searchform' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1019 ]
1020 ]
1021 );
1022
1023 $this->add_group_control(
1024 Group_Control_Border::get_type(),
1025 [
1026 'name' => 'advanced_search_border',
1027 'label' => esc_html__( 'Search Box Border', 'betterdocs' ),
1028 'selector' => '{{WRAPPER}} .betterdocs-searchform'
1029 ]
1030 );
1031
1032 $this->add_control(
1033 'search_box_outer_width',
1034 [
1035 'label' => esc_html__( 'Size', 'betterdocs' ),
1036 'type' => Controls_Manager::SLIDER,
1037 'size_units' => [ 'px', '%', 'em' ],
1038 'default' => [
1039 'unit' => '%',
1040 'size' => 100
1041 ],
1042 'selectors' => [
1043 '{{WRAPPER}} .betterdocs-searchform' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
1044 ]
1045 ]
1046 );
1047
1048 $this->add_responsive_control(
1049 'search_field_padding_radius',
1050 [
1051 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
1052 'type' => Controls_Manager::DIMENSIONS,
1053 'size_units' => [ 'px', 'em', '%' ],
1054 'selectors' => [
1055 '{{WRAPPER}} .betterdocs-searchform' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1056 ]
1057 ]
1058 );
1059
1060 $this->add_control(
1061 'field_search_icon_heading',
1062 [
1063 'label' => esc_html__( 'Search Icon', 'betterdocs' ),
1064 'type' => Controls_Manager::HEADING,
1065 'separator' => 'before'
1066 ]
1067 );
1068
1069 $this->add_control(
1070 'field_search_icon_color',
1071 [
1072 'label' => esc_html__( 'Color', 'betterdocs' ),
1073 'type' => Controls_Manager::COLOR,
1074 'selectors' => [
1075 '{{WRAPPER}} .betterdocs-searchform svg.docs-search-icon' => 'fill: {{VALUE}};'
1076 ]
1077 ]
1078 );
1079
1080 $this->add_control(
1081 'field_search_icon_size',
1082 [
1083 'label' => esc_html__( 'Size', 'betterdocs' ),
1084 'type' => Controls_Manager::SLIDER,
1085 'size_units' => [ 'px', '%', 'em' ],
1086 'range' => [
1087 'px' => [
1088 'max' => 500
1089 ]
1090 ],
1091 'selectors' => [
1092 '{{WRAPPER}} .betterdocs-searchform svg.docs-search-icon' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
1093 ]
1094 ]
1095 );
1096
1097 $this->add_control(
1098 'field_close_icon_heading',
1099 [
1100 'label' => esc_html__( 'Close Icon', 'betterdocs' ),
1101 'type' => Controls_Manager::HEADING,
1102 'separator' => 'before'
1103 ]
1104 );
1105
1106 $this->add_control(
1107 'search_field_close_icon_color',
1108 [
1109 'label' => esc_html__( 'Color', 'betterdocs' ),
1110 'type' => Controls_Manager::COLOR,
1111 'selectors' => [
1112 '{{WRAPPER}} .docs-search-close .close-line' => 'fill: {{VALUE}};'
1113 ]
1114 ]
1115 );
1116
1117 $this->add_control(
1118 'search_field_close_icon_border_color',
1119 [
1120 'label' => esc_html__( 'Border Color', 'betterdocs' ),
1121 'type' => Controls_Manager::COLOR,
1122 'selectors' => [
1123 '{{WRAPPER}} .docs-search-loader, {{WRAPPER}} .docs-search-close .close-border' => 'fill: {{VALUE}};'
1124 ]
1125 ]
1126 );
1127
1128 $this->end_controls_section(); # end of 'Search Field'
1129 }
1130
1131 public function search_field_layout_2() {
1132 /**
1133 * ----------------------------------------------------------
1134 * Section: Search Field
1135 * ----------------------------------------------------------
1136 */
1137 $this->start_controls_section(
1138 'section_search_field_settings_layout_2',
1139 [
1140 'label' => __( 'Search Field', 'betterdocs' ),
1141 'tab' => Controls_Manager::TAB_STYLE,
1142 'condition' => [
1143 'layout_select' => 'layout-2'
1144 ]
1145 ]
1146 );
1147
1148 $this->add_control(
1149 'search_field_bg_layout_2',
1150 [
1151 'label' => esc_html__( 'Field Background Color', 'betterdocs' ),
1152 'type' => Controls_Manager::COLOR,
1153 'selectors' => [
1154 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar, {{WRAPPER}} .betterdocs-search-form-widget-wrapper .betterdocs-live-search .betterdocs-searchform' => 'background: {{VALUE}};'
1155 ]
1156 ]
1157 );
1158
1159 $this->add_control(
1160 'search_field_text_color_layout_2',
1161 [
1162 'label' => esc_html__( 'Text Color', 'betterdocs' ),
1163 'type' => Controls_Manager::COLOR,
1164 'selectors' => [
1165 '{{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}};'
1166 ]
1167 ]
1168 );
1169
1170 $this->add_group_control(
1171 Group_Control_Typography::get_type(),
1172 [
1173 'name' => 'search_field_text_typography_layout_2',
1174 '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'
1175 ]
1176 );
1177
1178 $this->add_responsive_control(
1179 'search_field_padding_layout_2',
1180 [
1181 'label' => __( 'Field Padding', 'betterdocs' ),
1182 'type' => Controls_Manager::DIMENSIONS,
1183 'size_units' => [ 'px', 'em', '%' ],
1184 'selectors' => [
1185 '{{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}};'
1186 ]
1187 ]
1188 );
1189
1190 $this->add_responsive_control(
1191 'search_box_outer_margin_layout_2',
1192 [
1193 'label' => __( 'Search Box Margin', 'betterdocs' ),
1194 'type' => Controls_Manager::DIMENSIONS,
1195 'size_units' => [ 'px', 'em', '%' ],
1196 'selectors' => [
1197 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1198 ],
1199 'condition' => [
1200 'layout_select' => [ 'layout-2' ],
1201 'search_modal_layout' => [ 'layout-1' ]
1202 ]
1203 ]
1204 );
1205
1206 $this->add_responsive_control(
1207 'advanced_search_padding_layout_2',
1208 [
1209 'label' => __( 'Search Box Padding', 'betterdocs' ),
1210 'type' => Controls_Manager::DIMENSIONS,
1211 'size_units' => [ 'px', 'em', '%' ],
1212 'selectors' => [
1213 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1214 ],
1215 'condition' => [
1216 'layout_select' => [ 'layout-2' ],
1217 'search_modal_layout' => [ 'layout-1' ]
1218 ]
1219 ]
1220 );
1221
1222 $this->add_group_control(
1223 Group_Control_Border::get_type(),
1224 [
1225 'name' => 'advanced_search_border_layout_2',
1226 'label' => esc_html__( 'Search Box Border', 'betterdocs' ),
1227 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar',
1228 'condition' => [
1229 'layout_select' => [ 'layout-2' ],
1230 'search_modal_layout' => [ 'layout-1' ]
1231 ]
1232 ],
1233 );
1234
1235 $this->add_control(
1236 'search_box_outer_width_layout_2',
1237 [
1238 'label' => esc_html__( 'Size', 'betterdocs' ),
1239 'type' => Controls_Manager::SLIDER,
1240 'size_units' => [ 'px', '%', 'em' ],
1241 'default' => [
1242 'unit' => '%',
1243 'size' => 100
1244 ],
1245 'selectors' => [
1246 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
1247 ],
1248 'condition' => [
1249 'layout_select' => [ 'layout-2' ],
1250 'search_modal_layout' => [ 'layout-1' ]
1251 ]
1252 ]
1253 );
1254
1255 $this->add_responsive_control(
1256 'search_field_padding_radius_layout_2',
1257 [
1258 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
1259 'type' => Controls_Manager::DIMENSIONS,
1260 'size_units' => [ 'px', 'em', '%' ],
1261 'selectors' => [
1262 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1263 ],
1264 'condition' => [
1265 'layout_select' => [ 'layout-2' ],
1266 'search_modal_layout' => [ 'layout-1' ]
1267 ]
1268 ]
1269 );
1270
1271 $this->add_control(
1272 'field_search_icon_heading_layout_2',
1273 [
1274 'label' => esc_html__( 'Search Icon', 'betterdocs' ),
1275 'type' => Controls_Manager::HEADING,
1276 'separator' => 'before'
1277 ]
1278 );
1279
1280 $this->add_control(
1281 'field_search_icon_color_layout_2',
1282 [
1283 'label' => esc_html__( 'Color', 'betterdocs' ),
1284 'type' => Controls_Manager::COLOR,
1285 'selectors' => [
1286 '{{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}};'
1287 ]
1288 ]
1289 );
1290
1291 $this->add_control(
1292 'field_search_icon_size_layout_2',
1293 [
1294 'label' => esc_html__( 'Size', 'betterdocs' ),
1295 'type' => Controls_Manager::SLIDER,
1296 'size_units' => [ 'px', '%', 'em' ],
1297 'range' => [
1298 'px' => [
1299 'max' => 500
1300 ]
1301 ],
1302 'selectors' => [
1303 '{{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;'
1304 ]
1305 ]
1306 );
1307
1308 $this->add_control(
1309 'field_search_button_heading_layout_2',
1310 [
1311 'label' => esc_html__( 'Search Button', 'betterdocs' ),
1312 'type' => Controls_Manager::HEADING,
1313 'separator' => 'before'
1314 ]
1315 );
1316
1317 $this->add_control(
1318 'field_search_button_color_layout_2',
1319 [
1320 'label' => esc_html__( 'Color', 'betterdocs' ),
1321 'type' => Controls_Manager::COLOR,
1322 'selectors' => [
1323 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button, {{WRAPPER}} .betterdocs-search-modal-archive .betterdocs-live-search .betterdocs-searchform .search-button' => 'color: {{VALUE}};'
1324 ]
1325 ]
1326 );
1327
1328 $this->add_control(
1329 'field_search_button_background_color_layout_2',
1330 [
1331 'label' => esc_html__( 'Background Color', 'betterdocs' ),
1332 'type' => Controls_Manager::COLOR,
1333 'selectors' => [
1334 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button, {{WRAPPER}} .betterdocs-search-modal-archive .betterdocs-live-search .betterdocs-searchform .search-button' => 'background-color: {{VALUE}};'
1335 ]
1336 ]
1337 );
1338
1339 $this->add_responsive_control(
1340 'field_search_button_border_radius_layout_2',
1341 [
1342 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
1343 'type' => Controls_Manager::DIMENSIONS,
1344 'size_units' => [ 'px', 'em', '%' ],
1345 'selectors' => [
1346 '{{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}};'
1347 ]
1348 ]
1349 );
1350
1351 $this->add_group_control(
1352 Group_Control_Typography::get_type(),
1353 [
1354 'name' => 'field_search_button_typography_layout_2',
1355 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button, {{WRAPPER}} .betterdocs-search-modal-archive .betterdocs-live-search .betterdocs-searchform .search-button'
1356 ]
1357 );
1358
1359 $this->end_controls_section(); # end of 'Search Field'
1360 }
1361
1362 public function search_modal_layout() {
1363 $this->start_controls_section(
1364 'search_modal',
1365 [
1366 'label' => __( 'Search Modal', 'betterdocs' ),
1367 'tab' => Controls_Manager::TAB_STYLE,
1368 'condition' => [
1369 'layout_select' => 'layout-2'
1370 ]
1371 ]
1372 );
1373
1374 $this->add_control(
1375 'search_modal_field',
1376 [
1377 'label' => esc_html__( 'Search Field', 'betterdocs' ),
1378 'type' => \Elementor\Controls_Manager::HEADING,
1379 'separator' => 'before',
1380 ]
1381 );
1382
1383 $this->add_responsive_control(
1384 'search_magnifier_color',
1385 [
1386 'label' => esc_html__( 'Magnifier Color', 'betterdocs' ),
1387 'type' => Controls_Manager::COLOR,
1388 'selectors' => [
1389 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header svg g path' => 'fill: {{VALUE}};'
1390 ]
1391 ]
1392 );
1393
1394 $this->add_responsive_control(
1395 'search_field_background_color',
1396 [
1397 'label' => esc_html__( 'Field Background Color', 'betterdocs' ),
1398 'type' => Controls_Manager::COLOR,
1399 'selectors' => [
1400 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header' => 'background-color: {{VALUE}};'
1401 ]
1402 ]
1403 );
1404
1405 $this->add_group_control(
1406 Group_Control_Typography::get_type(),
1407 [
1408 'name' => 'search_modal_field_typography',
1409 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap .betterdocs-search-field'
1410 ]
1411 );
1412
1413 $this->add_responsive_control(
1414 'search_modal_field_color',
1415 [
1416 'label' => esc_html__( 'Field Text Color', 'betterdocs' ),
1417 'type' => Controls_Manager::COLOR,
1418 'selectors' => [
1419 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap .betterdocs-search-field' => 'color: {{VALUE}};'
1420 ]
1421 ]
1422 );
1423
1424 $this->add_responsive_control(
1425 'search_modal_field_placeholder_color',
1426 [
1427 'label' => esc_html__( 'Field Placeholder Color', 'betterdocs' ),
1428 'type' => Controls_Manager::COLOR,
1429 'selectors' => [
1430 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap .betterdocs-search-field::placeholder' => 'color: {{VALUE}};'
1431 ]
1432 ]
1433 );
1434
1435 $this->add_control(
1436 'search_modal_category_section',
1437 [
1438 'label' => esc_html__( 'Search Category', 'betterdocs' ),
1439 'type' => \Elementor\Controls_Manager::HEADING,
1440 'separator' => 'before',
1441 ]
1442 );
1443
1444 $this->add_responsive_control(
1445 'search_modal_categories_color',
1446 [
1447 'label' => esc_html__( 'Color', 'betterdocs' ),
1448 'type' => Controls_Manager::COLOR,
1449 'selectors' => [
1450 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-select-option-wrapper .betterdocs-form-select' => 'color: {{VALUE}};'
1451 ]
1452 ]
1453 );
1454
1455 $this->add_group_control(
1456 Group_Control_Typography::get_type(),
1457 [
1458 'name' => 'search_modal_categories_typography',
1459 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-select-option-wrapper .betterdocs-form-select'
1460 ]
1461 );
1462
1463 $this->add_control(
1464 'search_modal_content_tabs',
1465 [
1466 'label' => esc_html__( 'Content Tabs', 'betterdocs' ),
1467 'type' => \Elementor\Controls_Manager::HEADING,
1468 'separator' => 'before',
1469 ]
1470 );
1471
1472 $this->add_group_control(
1473 Group_Control_Typography::get_type(),
1474 [
1475 'name' => 'search_modal_content_tabs_typography',
1476 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-info-tab .betterdocs-tab-items span'
1477 ]
1478 );
1479
1480 $this->add_control(
1481 'search_modal_content_tabs_icon_size',
1482 [
1483 'label' => __( 'Icon Size', 'betterdocs' ),
1484 'type' => Controls_Manager::SLIDER,
1485 'size_units' => [ 'px', '%' ],
1486 'range' => [
1487 'px' => [
1488 'min' => 0,
1489 'max' => 1000,
1490 'step' => 5
1491 ],
1492 '%' => [
1493 'min' => 0,
1494 'max' => 100
1495 ]
1496 ],
1497 'selectors' => [
1498 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-info-tab .betterdocs-tab-items span svg' => 'height: {{SIZE}}{{UNIT}}; width:{{SIZE}}{{UNIT}};'
1499 ]
1500 ]
1501 );
1502
1503 $this->add_responsive_control(
1504 'search_modal_content_tabs_icon_colors',
1505 [
1506 'label' => esc_html__( 'Icon Color', 'betterdocs' ),
1507 'type' => Controls_Manager::COLOR,
1508 'selectors' => [
1509 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-info-tab .betterdocs-tab-items span svg path' => 'fill: {{VALUE}};'
1510 ]
1511 ]
1512 );
1513
1514 $this->add_group_control(
1515 Group_Control_Border::get_type(),
1516 [
1517 'name' => 'search_modal_content_active_tab_border',
1518 'label' => esc_html__( 'Border', 'betterdocs' ),
1519 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-info-tab .betterdocs-tab-items.active'
1520 ]
1521 );
1522
1523 $this->add_control(
1524 'search_modal_content_list',
1525 [
1526 'label' => esc_html__( 'Content List', 'betterdocs' ),
1527 'type' => \Elementor\Controls_Manager::HEADING,
1528 'separator' => 'before',
1529 ]
1530 );
1531
1532 $this->add_group_control(
1533 Group_Control_Typography::get_type(),
1534 [
1535 'name' => 'search_modal_content_list_typography',
1536 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-items-wrapper .betterdocs-search-item-content .betterdocs-search-item-list .content-main h4'
1537 ]
1538 );
1539
1540 $this->add_responsive_control(
1541 'search_modal_content_list_color',
1542 [
1543 'label' => esc_html__( 'Color', 'betterdocs' ),
1544 'type' => Controls_Manager::COLOR,
1545 'selectors' => [
1546 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-items-wrapper .betterdocs-search-item-content .betterdocs-search-item-list .content-main h4' => 'color: {{VALUE}};'
1547 ]
1548 ]
1549 );
1550
1551 $this->add_control(
1552 'search_modal_content_list_icon_size',
1553 [
1554 'label' => __( 'Icon Size', 'betterdocs' ),
1555 'type' => Controls_Manager::SLIDER,
1556 'size_units' => [ 'px', '%' ],
1557 'range' => [
1558 'px' => [
1559 'min' => 0,
1560 'max' => 1000,
1561 'step' => 5
1562 ],
1563 '%' => [
1564 'min' => 0,
1565 'max' => 100
1566 ]
1567 ],
1568 'selectors' => [
1569 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-items-wrapper .betterdocs-search-item-content .betterdocs-search-item-list .content-main svg' => 'height: {{SIZE}}{{UNIT}}; width:{{SIZE}}{{UNIT}};'
1570 ]
1571 ]
1572 );
1573
1574 $this->add_group_control(
1575 Group_Control_Border::get_type(),
1576 [
1577 'name' => 'search_modal_content_list_border',
1578 'label' => esc_html__( 'Border', 'betterdocs' ),
1579 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-items-wrapper .betterdocs-search-item-content .betterdocs-search-item-list'
1580 ]
1581 );
1582
1583 $this->add_control(
1584 'search_modal_content_list_category',
1585 [
1586 'label' => esc_html__( 'Content List Category', 'betterdocs' ),
1587 'type' => \Elementor\Controls_Manager::HEADING,
1588 'separator' => 'before',
1589 ]
1590 );
1591
1592 $this->add_group_control(
1593 Group_Control_Typography::get_type(),
1594 [
1595 'name' => 'search_modal_content_list_category_typography',
1596 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-items-wrapper .betterdocs-search-item-content .betterdocs-search-item-list .content-sub h5'
1597 ]
1598 );
1599
1600 $this->add_responsive_control(
1601 'search_modal_content_list_category_color',
1602 [
1603 'label' => esc_html__( 'Color', 'betterdocs' ),
1604 'type' => Controls_Manager::COLOR,
1605 'selectors' => [
1606 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-items-wrapper .betterdocs-search-item-content .betterdocs-search-item-list .content-sub h5' => 'color: {{VALUE}};'
1607 ]
1608 ]
1609 );
1610
1611 $this->add_control(
1612 'search_modal_content_list_category_icon_size',
1613 [
1614 'label' => __( 'Icon Size', 'betterdocs' ),
1615 'type' => Controls_Manager::SLIDER,
1616 'size_units' => [ 'px', '%' ],
1617 'range' => [
1618 'px' => [
1619 'min' => 0,
1620 'max' => 1000,
1621 'step' => 5
1622 ],
1623 '%' => [
1624 'min' => 0,
1625 'max' => 100
1626 ]
1627 ],
1628 'selectors' => [
1629 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-items-wrapper .betterdocs-search-item-content .betterdocs-search-item-list .content-sub svg' => 'height: {{SIZE}}{{UNIT}}; width:{{SIZE}}{{UNIT}};'
1630 ]
1631 ]
1632 );
1633
1634 $this->end_controls_section();
1635 }
1636
1637 public function search_result_box_layout_1() {
1638 /**
1639 * ----------------------------------------------------------
1640 * Section: Search Result Box
1641 * ----------------------------------------------------------
1642 */
1643 $this->start_controls_section(
1644 'section_search_result_settings',
1645 [
1646 'label' => __( 'Search Result Box', 'betterdocs' ),
1647 'tab' => Controls_Manager::TAB_STYLE,
1648 'condition' => [
1649 'layout_select' => 'layout-1'
1650 ]
1651 ]
1652 );
1653
1654 $this->add_responsive_control(
1655 'result_box_width',
1656 [
1657 'label' => __( 'Width', 'betterdocs' ),
1658 'type' => Controls_Manager::SLIDER,
1659 'default' => [
1660 'size' => 100,
1661 'unit' => '%'
1662 ],
1663 'size_units' => [ '%', 'px', 'em' ],
1664 'range' => [
1665 '%' => [
1666 'max' => 100,
1667 'step' => 1
1668 ]
1669 ],
1670 'selectors' => [
1671 '{{WRAPPER}} .betterdocs-live-search .docs-search-result' => 'width: {{SIZE}}{{UNIT}};'
1672 ]
1673 ]
1674 );
1675
1676 $this->add_responsive_control(
1677 'result_box_max_width',
1678 [
1679 'label' => __( 'Max Width', 'betterdocs' ),
1680 'type' => Controls_Manager::SLIDER,
1681 'default' => [
1682 'size' => 1600,
1683 'unit' => 'px'
1684 ],
1685 'size_units' => [ 'px', 'em' ],
1686 'range' => [
1687 'px' => [
1688 'max' => 1600,
1689 'step' => 1
1690 ]
1691 ],
1692 'selectors' => [
1693 '{{WRAPPER}} .betterdocs-live-search .docs-search-result' => 'max-width: {{SIZE}}{{UNIT}};'
1694 ]
1695 ]
1696 );
1697
1698 $this->add_group_control(
1699 Group_Control_Background::get_type(),
1700 [
1701 'name' => 'result_box_bg',
1702 'types' => [ 'classic', 'gradient' ],
1703 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result'
1704 ]
1705 );
1706
1707 $this->add_group_control(
1708 Group_Control_Border::get_type(),
1709 [
1710 'name' => 'result_box_border',
1711 'label' => esc_html__( 'Border', 'betterdocs' ),
1712 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result'
1713 ]
1714 );
1715
1716 $this->end_controls_section(); # end of 'Search Result Box'
1717 }
1718
1719 public function search_result_list_layout_1() {
1720 /**
1721 * ----------------------------------------------------------
1722 * Section: Search Result Item
1723 * ----------------------------------------------------------
1724 */
1725 $this->start_controls_section(
1726 'section_search_result_item_settings',
1727 [
1728 'label' => __( 'Search Result List', 'betterdocs' ),
1729 'tab' => Controls_Manager::TAB_STYLE,
1730 'condition' => [
1731 'layout_select' => 'layout-1'
1732 ]
1733 ]
1734 );
1735
1736 $this->start_controls_tabs( 'item_settings_tab' );
1737
1738 // Normal State Tab
1739 $this->start_controls_tab(
1740 'item_normal',
1741 [ 'label' => esc_html__( 'Normal', 'betterdocs' ) ]
1742 );
1743
1744 $this->add_control(
1745 'result_box_item',
1746 [
1747 'label' => esc_html__( 'Item', 'betterdocs' ),
1748 'type' => Controls_Manager::HEADING
1749 ]
1750 );
1751
1752 $this->add_group_control(
1753 Group_Control_Typography::get_type(),
1754 [
1755 'name' => 'result_box_item_typography',
1756 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li a .betterdocs-search-title'
1757 ]
1758 );
1759
1760 $this->add_control(
1761 'result_box_item_color',
1762 [
1763 'label' => esc_html__( 'Item Color', 'betterdocs' ),
1764 'type' => Controls_Manager::COLOR,
1765 'selectors' => [
1766 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li a .betterdocs-search-title' => 'color: {{VALUE}};'
1767 ]
1768 ]
1769 );
1770
1771 $this->add_group_control(
1772 Group_Control_Border::get_type(),
1773 [
1774 'name' => 'result_item_border',
1775 'label' => esc_html__( 'Border', 'betterdocs' ),
1776 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li'
1777 ]
1778 );
1779
1780 $this->add_responsive_control(
1781 'result_box_item_padding',
1782 [
1783 'label' => __( 'Padding', 'betterdocs' ),
1784 'type' => Controls_Manager::DIMENSIONS,
1785 'size_units' => [ 'px', 'em', '%' ],
1786 'selectors' => [
1787 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1788 ]
1789 ]
1790 );
1791
1792 $this->add_control(
1793 'search_result_box_item_category',
1794 [
1795 'label' => esc_html__( 'Category', 'betterdocs' ),
1796 'type' => Controls_Manager::HEADING,
1797 'separator' => 'before'
1798 ]
1799 );
1800
1801 $this->add_group_control(
1802 Group_Control_Typography::get_type(),
1803 [
1804 'name' => 'result_box_item_category_typography',
1805 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li span.betterdocs-search-category'
1806 ]
1807 );
1808
1809 $this->add_control(
1810 'result_box_item_category_color',
1811 [
1812 'label' => esc_html__( 'Color', 'betterdocs' ),
1813 'type' => Controls_Manager::COLOR,
1814 'selectors' => [
1815 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li span.betterdocs-search-category' => 'color: {{VALUE}};'
1816 ]
1817 ]
1818 );
1819
1820 $this->end_controls_tab();
1821
1822 // Hover State Tab
1823 $this->start_controls_tab(
1824 'item_hover',
1825 [ 'label' => esc_html__( 'Hover', 'betterdocs' ) ]
1826 );
1827
1828 $this->add_responsive_control(
1829 'result_item_transition',
1830 [
1831 'label' => __( 'Transition', 'betterdocs' ),
1832 'type' => Controls_Manager::SLIDER,
1833 'default' => [
1834 'size' => 300,
1835 'unit' => '%'
1836 ],
1837 'size_units' => [ '%' ],
1838 'range' => [
1839 '%' => [
1840 'max' => 2500,
1841 'step' => 1
1842 ]
1843 ],
1844 'selectors' => [
1845 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li, {{WRAPPER}} .betterdocs-live-search .docs-search-result li a, {{WRAPPER}} .betterdocs-live-search .docs-search-result li span, {{WRAPPER}} .betterdocs-live-search .docs-search-result' => 'transition: {{SIZE}}ms;'
1846 ]
1847 ]
1848 );
1849
1850 $this->add_control(
1851 'result_box_item_hover_heading',
1852 [
1853 'label' => esc_html__( 'Item', 'betterdocs' ),
1854 'type' => Controls_Manager::HEADING
1855 ]
1856 );
1857
1858 $this->add_group_control(
1859 Group_Control_Background::get_type(),
1860 [
1861 'name' => 'result_box_item_hover_bg',
1862 'types' => [ 'classic', 'gradient' ],
1863 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover',
1864 'exclude' => [
1865 'image'
1866 ]
1867 ]
1868 );
1869
1870 $this->add_control(
1871 'result_box_item_hover_color',
1872 [
1873 'label' => esc_html__( 'Item Color', 'betterdocs' ),
1874 'type' => Controls_Manager::COLOR,
1875 'selectors' => [
1876 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover a' => 'color: {{VALUE}};'
1877 ]
1878 ]
1879 );
1880
1881 $this->add_group_control(
1882 Group_Control_Border::get_type(),
1883 [
1884 'name' => 'result_item_hover_border',
1885 'label' => esc_html__( 'Border', 'betterdocs' ),
1886 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover'
1887 ]
1888 );
1889
1890 $this->add_control(
1891 'result_box_item_hover_count_heading',
1892 [
1893 'label' => esc_html__( 'Count', 'betterdocs' ),
1894 'type' => Controls_Manager::HEADING,
1895 'separator' => 'before'
1896 ]
1897 );
1898
1899 $this->add_control(
1900 'result_box_item_hover_count_color',
1901 [
1902 'label' => esc_html__( 'Item Color', 'betterdocs' ),
1903 'type' => Controls_Manager::COLOR,
1904 'selectors' => [
1905 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover span' => 'color: {{VALUE}};'
1906 ]
1907 ]
1908 );
1909 $this->end_controls_tab();
1910 $this->end_controls_tabs();
1911
1912 $this->end_controls_section(); # end of 'Search Result Item'
1913
1914 do_action( 'betterdocs/elementor/widgets/advanced-search/controllers', $this );
1915 }
1916
1917 public function render_callback() {
1918 $settings = &$this->attributes;
1919
1920 // Always ensure content is output to prevent empty widget background
1921 if ( $settings['layout_select'] == 'layout-1' ) {
1922 $this->views( 'widgets/search-form' );
1923 } else {
1924 $number_of_docs = isset( $settings['initial_docs_number'] ) ? $settings['initial_docs_number'] : '';
1925 $number_of_faqs = isset( $settings['initial_faqs_number'] ) ? $settings['initial_faqs_number'] : '';
1926 $doc_categories_ids = isset( $settings['search_modal_query_term_ids'] ) ? $settings['search_modal_query_term_ids'] : '';
1927 $doc_ids = isset( $settings['search_modal_query_doc_ids'] ) ? $settings['search_modal_query_doc_ids'] : '';
1928 $faq_categories_ids = isset( $settings['search_modal_query_faq_term_ids'] ) ? $settings['search_modal_query_faq_term_ids'] : '';
1929 $search_modal_layout = isset( $settings['search_modal_layout'] ) ? $settings['search_modal_layout'] : 'layout-1';
1930 $search_modal_search_type = betterdocs()->settings->get('search_modal_search_type');
1931
1932 // Ensure we always output content, especially in edit mode
1933 echo '<div class="betterdocs-search-form-widget-wrapper">';
1934 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' ) . '"]' );
1935 echo '</div>';
1936 }
1937
1938 // Add editor-specific styles to prevent empty widget background
1939 if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
1940 echo '<style>
1941 .elementor-widget-betterdocs-search-form {
1942 background-color: transparent !important;
1943 }
1944 .elementor-widget-betterdocs-search-form .elementor-widget-container {
1945 min-height: 50px;
1946 }
1947 </style>';
1948 }
1949 }
1950
1951 public function view_params() {
1952 $settings = &$this->attributes;
1953
1954 $popular_search_title = isset( $settings['advance_search_popular_search_title_placeholder'] ) ? $settings['advance_search_popular_search_title_placeholder'] : '';
1955 $category_search_toggle = isset( $settings['betterdocs_category_search_toogle'] ) ? $settings['betterdocs_category_search_toogle'] : '';
1956 $search_button_toggle = isset( $settings['betterdocs_search_button_toogle'] ) ? $settings['betterdocs_search_button_toogle'] : true;
1957 $popular_search_toggle = isset( $settings['betterdocs_popular_search_toogle'] ) ? $settings['betterdocs_popular_search_toogle'] : '';
1958
1959 $_shortcode_attributes = apply_filters(
1960 'betterdocs_elementor_search_form_params',
1961 [
1962 'enable_heading' => 'true',
1963 'popular_search_title' => $popular_search_title,
1964 'category_search' => $category_search_toggle,
1965 'search_button' => $search_button_toggle,
1966 'popular_search' => $popular_search_toggle,
1967 'heading' => esc_html( $settings['section_search_field_heading'] ),
1968 'subheading' => esc_html( $settings['section_search_field_sub_heading'] ),
1969 'heading_tag' => esc_attr( $settings['section_search_field_heading_tag'] ),
1970 'subheading_tag' => esc_attr( $settings['section_search_field_subheading_tag'] ),
1971 'placeholder' => esc_html( $settings['section_search_field_placeholder'] )
1972 ],
1973 $this->attributes
1974 );
1975
1976 return [
1977 'shortcode_attr' => $_shortcode_attributes
1978 ];
1979 }
1980
1981 // Prevent empty widget background in Elementor
1982 protected function should_print_empty() {
1983 return false;
1984 }
1985
1986 // In plain mode, render without shortcode
1987 public function render_plain_content() {
1988 $settings = $this->get_settings_for_display();
1989 echo '[betterdocs_search_form placeholder="' . esc_attr( $settings['section_search_field_placeholder'] ) . '"]';
1990 }
1991 }
1992