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.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 3.8.9, at includes/Editors/Elementor/Widget/Basic/SearchForm.php

1,447 lines 42.3 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->search_modal_layout();
82 }
83
84 public function layout_selection() {
85 $this->start_controls_section(
86 'layout_selection_section',
87 [
88 'label' => __( 'Search Layout', 'betterdocs' ),
89 'tab' => Controls_Manager::TAB_CONTENT
90 ]
91 );
92
93 $this->add_control(
94 'layout_select',
95 [
96 'label' => esc_html__( 'Select layout', 'betterdocs' ),
97 'type' => Controls_Manager::SELECT,
98 'default' => 'layout-2',
99 'label_block' => false,
100 'options' => [
101 'layout-1' => esc_html__( 'Classic Layout', 'betterdocs' ),
102 'layout-2' => esc_html__( 'Modal Layout', 'betterdocs' )
103 ]
104 ]
105 );
106
107 $this->end_controls_section();
108 }
109
110 public function search_modal_query() {
111 $this->start_controls_section(
112 'search_modal_query',
113 [
114 'label' => __( 'Modal Query', 'betterdocs' ),
115 'condition' => [
116 'layout_select' => [ 'layout-2' ]
117 ]
118 ]
119 );
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
145 $this->add_control(
146 'search_modal_doc_query_type',
147 [
148 'label' => __( 'Select Docs Type', 'betterdocs' ),
149 'label_block' => true,
150 'type' => Controls_Manager::SELECT2,
151 'options' => [
152 'popular_docs' => __( 'Popular Docs', 'betterdocs' ),
153 'specific_doc_ids' => __( "Specific Doc Id's", 'betterdocs' ),
154 'specific_doc_term_ids' => __( "Specific Doc Term Id's", 'betterdocs' )
155 ],
156 'multiple' => false,
157 'default' => 'popular_docs'
158 ]
159 );
160
161 $this->add_control(
162 'search_modal_query_term_ids',
163 [
164 'label' => __( "Doc Term ID's", 'betterdocs' ),
165 'type' => Controls_Manager::TEXT,
166 'description' => __( 'Example: 8, 9', 'betterdocs' ),
167 'default' => '',
168 'condition' => [
169 'search_modal_doc_query_type' => 'specific_doc_term_ids'
170 ]
171 ]
172 );
173
174 $this->add_control(
175 'search_modal_query_doc_ids',
176 [
177 'label' => __( "Doc ID's", 'betterdocs' ),
178 'type' => Controls_Manager::TEXT,
179 'description' => __( 'Example: 15, 16', 'betterdocs' ),
180 'default' => '',
181 'condition' => [
182 'search_modal_doc_query_type' => 'specific_doc_ids'
183 ]
184 ]
185 );
186
187 $this->add_control(
188 'initial_docs_number',
189 [
190 'label' => __( 'Number of Docs', 'betterdocs' ),
191 'type' => Controls_Manager::NUMBER,
192 'default' => '5',
193 'condition' => [
194 'search_modal_doc_query_type' => 'popular_docs'
195 ]
196 ]
197 );
198
199 $this->add_control(
200 'search_modal_faq_query_type',
201 [
202 'label' => __( 'Select FAQ Type', 'betterdocs' ),
203 'label_block' => true,
204 'type' => Controls_Manager::SELECT2,
205 'default' => 'default',
206 'options' => [
207 'default' => __( 'Default', 'betterdocs' ),
208 'specific_faq_term_ids' => __( "Specific FAQ Term Id's", 'betterdocs' ),
209 ],
210 'multiple' => false,
211 ]
212 );
213
214 $this->add_control(
215 'search_modal_query_faq_term_ids',
216 [
217 'label' => __( "FAQ Term ID's", 'betterdocs' ),
218 'type' => Controls_Manager::TEXT,
219 'description' => __( 'Example: 8, 9', 'betterdocs' ),
220 'default' => '',
221 'condition' => [
222 'search_modal_faq_query_type' => 'specific_faq_term_ids'
223 ]
224 ]
225 );
226
227 $this->add_control(
228 'initial_faqs_number',
229 [
230 'label' => __( "Number of FAQ's", 'betterdocs' ),
231 'type' => Controls_Manager::NUMBER,
232 'default' => '5',
233 'condition' => [
234 'search_modal_faq_query_type' => 'default'
235 ]
236 ]
237 );
238
239 $this->end_controls_section();
240 }
241
242 public function return_mod_terms( $accumulator, $term ) {
243 $accumulator[ $term->term_id ] = htmlspecialchars_decode( $term->name );
244 return $accumulator;
245 }
246
247
248 public function search_content_settings() {
249 $this->start_controls_section(
250 'search_content_placeholders',
251 [
252 'label' => __( 'Search Content', 'betterdocs' ),
253 'tab' => Controls_Manager::TAB_CONTENT
254 ]
255 );
256
257 $this->add_control(
258 'section_search_field_placeholder',
259 [
260 'label' => __( 'Placeholder', 'betterdocs' ),
261 'type' => Controls_Manager::TEXT,
262 'default' => esc_html__( 'Search', 'betterdocs' )
263 ]
264 );
265
266 $this->add_control(
267 'section_search_field_heading',
268 [
269 'label' => __( 'Search Heading', 'betterdocs' ),
270 'type' => Controls_Manager::TEXT
271 ]
272 );
273
274 $this->add_control(
275 'section_search_field_sub_heading',
276 [
277 'label' => __( 'Search Subheading', 'betterdocs' ),
278 'type' => Controls_Manager::TEXT
279 ]
280 );
281
282 $this->add_control(
283 'betterdocs_search_button_toogle',
284 [
285 'label' => __( 'Enable Search Button', 'betterdocs' ),
286 'type' => Controls_Manager::SWITCHER,
287 'label_on' => __( 'On', 'betterdocs' ),
288 'label_off' => __( 'Off', 'betterdocs' ),
289 'return_value' => 'true',
290 'default' => true
291 ]
292 );
293
294 do_action( 'betterdocs/elementor/widgets/advanced-search/switcher', $this );
295
296 $this->end_controls_section();
297 }
298
299 public function search_box_layout_1() {
300 /**
301 * ----------------------------------------------------------
302 * Section: Search Box
303 * ----------------------------------------------------------
304 */
305 $this->start_controls_section(
306 'section_search_box_settings',
307 [
308 'label' => __( 'Search Box', 'betterdocs' ),
309 'tab' => Controls_Manager::TAB_STYLE,
310 'condition' => [
311 'layout_select' => 'layout-1'
312 ]
313 ]
314 );
315
316 $this->add_group_control(
317 Group_Control_Background::get_type(),
318 [
319 'name' => 'search_box_bg',
320 'types' => [ 'classic', 'gradient' ],
321 'selector' => '{{WRAPPER}} .betterdocs-search-form-wrapper'
322 ]
323 );
324
325 $this->add_responsive_control(
326 'search_box_padding',
327 [
328 'label' => esc_html__( 'Padding', 'betterdocs' ),
329 'type' => Controls_Manager::DIMENSIONS,
330 'size_units' => [ 'px', 'em', '%' ],
331 'default' => [
332 'top' => 50,
333 'right' => 50,
334 'bottom' => 50,
335 'left' => 50
336 ],
337 'selectors' => [
338 '{{WRAPPER}} .betterdocs-search-form-wrapper' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
339 ]
340 ]
341 );
342
343 $this->add_responsive_control(
344 'search_box_margin',
345 [
346 'label' => esc_html__( 'Margin', 'betterdocs' ),
347 'type' => Controls_Manager::DIMENSIONS,
348 'size_units' => [ 'px', 'em', '%' ],
349 'default' => [
350 'top' => 50,
351 'right' => 50,
352 'bottom' => 50,
353 'left' => 50
354 ],
355 'selectors' => [
356 '{{WRAPPER}} .betterdocs-search-form-wrapper' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
357 ]
358 ]
359 );
360
361 $this->end_controls_section(); # end of 'Search Box'
362 }
363
364 public function search_box_layout_2() {
365 /**
366 * ----------------------------------------------------------
367 * Section: Search Box
368 * ----------------------------------------------------------
369 */
370 $this->start_controls_section(
371 'section_search_box_settings_layout_2',
372 [
373 'label' => __( 'Search Box', 'betterdocs' ),
374 'tab' => Controls_Manager::TAB_STYLE,
375 'condition' => [
376 'layout_select' => 'layout-2'
377 ]
378 ]
379 );
380
381 $this->add_group_control(
382 Group_Control_Background::get_type(),
383 [
384 'name' => 'search_box_bg_layout_2',
385 'types' => [ 'classic', 'gradient' ],
386 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1'
387 ]
388 );
389
390 $this->add_responsive_control(
391 'search_box_padding_layout_2',
392 [
393 'label' => esc_html__( 'Padding', 'betterdocs' ),
394 'type' => Controls_Manager::DIMENSIONS,
395 'size_units' => [ 'px', 'em', '%' ],
396 'default' => [
397 'top' => 50,
398 'right' => 50,
399 'bottom' => 50,
400 'left' => 50
401 ],
402 'selectors' => [
403 '{{WRAPPER}} .betterdocs-search-layout-1' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
404 ]
405 ]
406 );
407
408 $this->add_responsive_control(
409 'search_box_margin_layout_2',
410 [
411 'label' => esc_html__( 'Margin', 'betterdocs' ),
412 'type' => Controls_Manager::DIMENSIONS,
413 'size_units' => [ 'px', 'em', '%' ],
414 'default' => [
415 'top' => 50,
416 'right' => 50,
417 'bottom' => 50,
418 'left' => 50
419 ],
420 'selectors' => [
421 '{{WRAPPER}} .betterdocs-search-layout-1' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
422 ]
423 ]
424 );
425
426 $this->end_controls_section(); # end of 'Search Box'
427 }
428
429 public function search_field_layout_1() {
430 /**
431 * ----------------------------------------------------------
432 * Section: Search Field
433 * ----------------------------------------------------------
434 */
435 $this->start_controls_section(
436 'section_search_field_settings',
437 [
438 'label' => __( 'Search Field', 'betterdocs' ),
439 'tab' => Controls_Manager::TAB_STYLE,
440 'condition' => [
441 'layout_select' => 'layout-1'
442 ]
443 ]
444 );
445
446 $this->add_control(
447 'search_field_bg',
448 [
449 'label' => esc_html__( 'Field Background Color', 'betterdocs' ),
450 'type' => Controls_Manager::COLOR,
451 'selectors' => [
452 '{{WRAPPER}} .betterdocs-searchform' => 'background: {{VALUE}};'
453 ]
454 ]
455 );
456
457 $this->add_control(
458 'search_field_text_color',
459 [
460 'label' => esc_html__( 'Text Color', 'betterdocs' ),
461 'type' => Controls_Manager::COLOR,
462 'selectors' => [
463 '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field' => 'color: {{VALUE}};'
464 ]
465 ]
466 );
467
468 $this->add_group_control(
469 Group_Control_Typography::get_type(),
470 [
471 'name' => 'search_field_text_typography',
472 'selector' => '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field'
473 ]
474 );
475
476 $this->add_responsive_control(
477 'search_field_padding',
478 [
479 'label' => __( 'Field Padding', 'betterdocs' ),
480 'type' => Controls_Manager::DIMENSIONS,
481 'size_units' => [ 'px', 'em', '%' ],
482 'selectors' => [
483 '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
484 ]
485 ]
486 );
487
488 $this->add_control(
489 'search_field_placeholder',
490 [
491 'label' => esc_html__( 'Field Placeholder Color', 'betterdocs' ),
492 'type' => Controls_Manager::COLOR,
493 'selectors' => [
494 '{{WRAPPER}} .betterdocs-searchform .betterdocs-search-field::placeholder' => 'color: {{VALUE}};'
495 ]
496 ]
497 );
498
499 $this->add_responsive_control(
500 'search_box_outer_margin',
501 [
502 'label' => __( 'Search Box Margin', 'betterdocs' ),
503 'type' => Controls_Manager::DIMENSIONS,
504 'size_units' => [ 'px', 'em', '%' ],
505 'selectors' => [
506 '{{WRAPPER}} .betterdocs-searchform' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
507 ]
508 ]
509 );
510
511 $this->add_responsive_control(
512 'advanced_search_padding',
513 [
514 'label' => __( 'Search Box Padding', 'betterdocs' ),
515 'type' => Controls_Manager::DIMENSIONS,
516 'size_units' => [ 'px', 'em', '%' ],
517 'selectors' => [
518 '{{WRAPPER}} .betterdocs-searchform' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
519 ]
520 ]
521 );
522
523 $this->add_group_control(
524 Group_Control_Border::get_type(),
525 [
526 'name' => 'advanced_search_border',
527 'label' => esc_html__( 'Search Box Border', 'betterdocs' ),
528 'selector' => '{{WRAPPER}} .betterdocs-searchform'
529 ]
530 );
531
532 $this->add_control(
533 'search_box_outer_width',
534 [
535 'label' => esc_html__( 'Size', 'betterdocs' ),
536 'type' => Controls_Manager::SLIDER,
537 'size_units' => [ 'px', '%', 'em' ],
538 'default' => [
539 'unit' => '%',
540 'size' => 100
541 ],
542 'selectors' => [
543 '{{WRAPPER}} .betterdocs-searchform' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
544 ]
545 ]
546 );
547
548 $this->add_responsive_control(
549 'search_field_padding_radius',
550 [
551 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
552 'type' => Controls_Manager::DIMENSIONS,
553 'size_units' => [ 'px', 'em', '%' ],
554 'selectors' => [
555 '{{WRAPPER}} .betterdocs-searchform' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
556 ]
557 ]
558 );
559
560 $this->add_control(
561 'field_search_icon_heading',
562 [
563 'label' => esc_html__( 'Search Icon', 'betterdocs' ),
564 'type' => Controls_Manager::HEADING,
565 'separator' => 'before'
566 ]
567 );
568
569 $this->add_control(
570 'field_search_icon_color',
571 [
572 'label' => esc_html__( 'Color', 'betterdocs' ),
573 'type' => Controls_Manager::COLOR,
574 'selectors' => [
575 '{{WRAPPER}} .betterdocs-searchform svg.docs-search-icon' => 'fill: {{VALUE}};'
576 ]
577 ]
578 );
579
580 $this->add_control(
581 'field_search_icon_size',
582 [
583 'label' => esc_html__( 'Size', 'betterdocs' ),
584 'type' => Controls_Manager::SLIDER,
585 'size_units' => [ 'px', '%', 'em' ],
586 'range' => [
587 'px' => [
588 'max' => 500
589 ]
590 ],
591 'selectors' => [
592 '{{WRAPPER}} .betterdocs-searchform svg.docs-search-icon' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
593 ]
594 ]
595 );
596
597 $this->add_control(
598 'field_close_icon_heading',
599 [
600 'label' => esc_html__( 'Close Icon', 'betterdocs' ),
601 'type' => Controls_Manager::HEADING,
602 'separator' => 'before'
603 ]
604 );
605
606 $this->add_control(
607 'search_field_close_icon_color',
608 [
609 'label' => esc_html__( 'Color', 'betterdocs' ),
610 'type' => Controls_Manager::COLOR,
611 'selectors' => [
612 '{{WRAPPER}} .docs-search-close .close-line' => 'fill: {{VALUE}};'
613 ]
614 ]
615 );
616
617 $this->add_control(
618 'search_field_close_icon_border_color',
619 [
620 'label' => esc_html__( 'Border Color', 'betterdocs' ),
621 'type' => Controls_Manager::COLOR,
622 'selectors' => [
623 '{{WRAPPER}} .docs-search-loader, {{WRAPPER}} .docs-search-close .close-border' => 'fill: {{VALUE}};'
624 ]
625 ]
626 );
627
628 $this->end_controls_section(); # end of 'Search Field'
629 }
630
631 public function search_field_layout_2() {
632 /**
633 * ----------------------------------------------------------
634 * Section: Search Field
635 * ----------------------------------------------------------
636 */
637 $this->start_controls_section(
638 'section_search_field_settings_layout_2',
639 [
640 'label' => __( 'Search Field', 'betterdocs' ),
641 'tab' => Controls_Manager::TAB_STYLE,
642 'condition' => [
643 'layout_select' => 'layout-2'
644 ]
645 ]
646 );
647
648 $this->add_control(
649 'search_field_bg_layout_2',
650 [
651 'label' => esc_html__( 'Field Background Color', 'betterdocs' ),
652 'type' => Controls_Manager::COLOR,
653 'selectors' => [
654 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'background: {{VALUE}};'
655 ]
656 ]
657 );
658
659 $this->add_control(
660 'search_field_text_color_layout_2',
661 [
662 'label' => esc_html__( 'Text Color', 'betterdocs' ),
663 'type' => Controls_Manager::COLOR,
664 'selectors' => [
665 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-input' => 'color: {{VALUE}};'
666 ]
667 ]
668 );
669
670 $this->add_group_control(
671 Group_Control_Typography::get_type(),
672 [
673 'name' => 'search_field_text_typography_layout_2',
674 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-input'
675 ]
676 );
677
678 $this->add_responsive_control(
679 'search_field_padding_layout_2',
680 [
681 'label' => __( 'Field Padding', 'betterdocs' ),
682 'type' => Controls_Manager::DIMENSIONS,
683 'size_units' => [ 'px', 'em', '%' ],
684 'selectors' => [
685 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
686 ]
687 ]
688 );
689
690 $this->add_responsive_control(
691 'search_box_outer_margin_layout_2',
692 [
693 'label' => __( 'Search Box Margin', 'betterdocs' ),
694 'type' => Controls_Manager::DIMENSIONS,
695 'size_units' => [ 'px', 'em', '%' ],
696 'selectors' => [
697 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
698 ]
699 ]
700 );
701
702 $this->add_responsive_control(
703 'advanced_search_padding_layout_2',
704 [
705 'label' => __( 'Search Box Padding', 'betterdocs' ),
706 'type' => Controls_Manager::DIMENSIONS,
707 'size_units' => [ 'px', 'em', '%' ],
708 'selectors' => [
709 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
710 ]
711 ]
712 );
713
714 $this->add_group_control(
715 Group_Control_Border::get_type(),
716 [
717 'name' => 'advanced_search_border_layout_2',
718 'label' => esc_html__( 'Search Box Border', 'betterdocs' ),
719 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar'
720 ]
721 );
722
723 $this->add_control(
724 'search_box_outer_width_layout_2',
725 [
726 'label' => esc_html__( 'Size', 'betterdocs' ),
727 'type' => Controls_Manager::SLIDER,
728 'size_units' => [ 'px', '%', 'em' ],
729 'default' => [
730 'unit' => '%',
731 'size' => 100
732 ],
733 'selectors' => [
734 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
735 ]
736 ]
737 );
738
739 $this->add_responsive_control(
740 'search_field_padding_radius_layout_2',
741 [
742 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
743 'type' => Controls_Manager::DIMENSIONS,
744 'size_units' => [ 'px', 'em', '%' ],
745 'selectors' => [
746 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
747 ]
748 ]
749 );
750
751 $this->add_control(
752 'field_search_icon_heading_layout_2',
753 [
754 'label' => esc_html__( 'Search Icon', 'betterdocs' ),
755 'type' => Controls_Manager::HEADING,
756 'separator' => 'before'
757 ]
758 );
759
760 $this->add_control(
761 'field_search_icon_color_layout_2',
762 [
763 'label' => esc_html__( 'Color', 'betterdocs' ),
764 'type' => Controls_Manager::COLOR,
765 'selectors' => [
766 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-icon g path' => 'fill: {{VALUE}};'
767 ]
768 ]
769 );
770
771 $this->add_control(
772 'field_search_icon_size_layout_2',
773 [
774 'label' => esc_html__( 'Size', 'betterdocs' ),
775 'type' => Controls_Manager::SLIDER,
776 'size_units' => [ 'px', '%', 'em' ],
777 'range' => [
778 'px' => [
779 'max' => 500
780 ]
781 ],
782 'selectors' => [
783 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-input-wrapper .search-icon' => 'width: {{SIZE}}{{UNIT}}; height: auto;'
784 ]
785 ]
786 );
787
788 $this->add_control(
789 'field_search_button_heading_layout_2',
790 [
791 'label' => esc_html__( 'Search Button', 'betterdocs' ),
792 'type' => Controls_Manager::HEADING,
793 'separator' => 'before'
794 ]
795 );
796
797 $this->add_control(
798 'field_search_button_color_layout_2',
799 [
800 'label' => esc_html__( 'Color', 'betterdocs' ),
801 'type' => Controls_Manager::COLOR,
802 'selectors' => [
803 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button' => 'color: {{VALUE}};'
804 ]
805 ]
806 );
807
808 $this->add_control(
809 'field_search_button_background_color_layout_2',
810 [
811 'label' => esc_html__( 'Background Color', 'betterdocs' ),
812 'type' => Controls_Manager::COLOR,
813 'selectors' => [
814 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button' => 'background-color: {{VALUE}};'
815 ]
816 ]
817 );
818
819 $this->add_responsive_control(
820 'field_search_button_border_radius_layout_2',
821 [
822 'label' => esc_html__( 'Border Radius', 'betterdocs' ),
823 'type' => Controls_Manager::DIMENSIONS,
824 'size_units' => [ 'px', 'em', '%' ],
825 'selectors' => [
826 '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
827 ]
828 ]
829 );
830
831 $this->add_group_control(
832 Group_Control_Typography::get_type(),
833 [
834 'name' => 'field_search_button_typography_layout_2',
835 'selector' => '{{WRAPPER}} .betterdocs-search-layout-1 .search-bar .search-button'
836 ]
837 );
838
839 $this->end_controls_section(); # end of 'Search Field'
840 }
841
842 public function search_modal_layout() {
843 $this->start_controls_section(
844 'search_modal',
845 [
846 'label' => __( 'Search Modal', 'betterdocs' ),
847 'tab' => Controls_Manager::TAB_STYLE,
848 'condition' => [
849 'layout_select' => 'layout-2'
850 ]
851 ]
852 );
853
854 $this->add_control(
855 'search_modal_field',
856 [
857 'label' => esc_html__( 'Search Field', 'betterdocs' ),
858 'type' => \Elementor\Controls_Manager::HEADING,
859 'separator' => 'before',
860 ]
861 );
862
863 $this->add_responsive_control(
864 'search_magnifier_color',
865 [
866 'label' => esc_html__( 'Magnifier Color', 'betterdocs' ),
867 'type' => Controls_Manager::COLOR,
868 'selectors' => [
869 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header svg g path' => 'fill: {{VALUE}};'
870 ]
871 ]
872 );
873
874 $this->add_responsive_control(
875 'search_field_background_color',
876 [
877 'label' => esc_html__( 'Field Background Color', 'betterdocs' ),
878 'type' => Controls_Manager::COLOR,
879 'selectors' => [
880 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap' => 'background-color: {{VALUE}};'
881 ]
882 ]
883 );
884
885 $this->add_group_control(
886 Group_Control_Typography::get_type(),
887 [
888 'name' => 'search_modal_field_typography',
889 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap .betterdocs-search-field'
890 ]
891 );
892
893 $this->add_responsive_control(
894 'search_modal_field_color',
895 [
896 'label' => esc_html__( 'Field Color', 'betterdocs' ),
897 'type' => Controls_Manager::COLOR,
898 'selectors' => [
899 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap .betterdocs-search-field' => 'color: {{VALUE}};'
900 ]
901 ]
902 );
903
904 $this->add_responsive_control(
905 'search_modal_field_placeholder_color',
906 [
907 'label' => esc_html__( 'Field Placeholder Color', 'betterdocs' ),
908 'type' => Controls_Manager::COLOR,
909 'selectors' => [
910 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-searchform-input-wrap .betterdocs-search-field::placeholder' => 'color: {{VALUE}};'
911 ]
912 ]
913 );
914
915 $this->add_control(
916 'search_modal_category_section',
917 [
918 'label' => esc_html__( 'Search Category', 'betterdocs' ),
919 'type' => \Elementor\Controls_Manager::HEADING,
920 'separator' => 'before',
921 ]
922 );
923
924 $this->add_responsive_control(
925 'search_modal_categories_color',
926 [
927 'label' => esc_html__( 'Color', 'betterdocs' ),
928 'type' => Controls_Manager::COLOR,
929 'selectors' => [
930 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-select-option-wrapper .betterdocs-form-select' => 'color: {{VALUE}};'
931 ]
932 ]
933 );
934
935 $this->add_group_control(
936 Group_Control_Typography::get_type(),
937 [
938 'name' => 'search_modal_categories_typography',
939 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-header .betterdocs-select-option-wrapper .betterdocs-form-select'
940 ]
941 );
942
943 $this->add_control(
944 'search_modal_content_tabs',
945 [
946 'label' => esc_html__( 'Content Tabs', 'betterdocs' ),
947 'type' => \Elementor\Controls_Manager::HEADING,
948 'separator' => 'before',
949 ]
950 );
951
952 $this->add_group_control(
953 Group_Control_Typography::get_type(),
954 [
955 'name' => 'search_modal_content_tabs_typography',
956 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-info-tab .betterdocs-tab-items span'
957 ]
958 );
959
960 $this->add_control(
961 'search_modal_content_tabs_icon_size',
962 [
963 'label' => __( 'Icon Size', 'betterdocs' ),
964 'type' => Controls_Manager::SLIDER,
965 'size_units' => [ 'px', '%' ],
966 'range' => [
967 'px' => [
968 'min' => 0,
969 'max' => 1000,
970 'step' => 5
971 ],
972 '%' => [
973 'min' => 0,
974 'max' => 100
975 ]
976 ],
977 'selectors' => [
978 '{{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}};'
979 ]
980 ]
981 );
982
983 $this->add_responsive_control(
984 'search_modal_content_tabs_icon_colors',
985 [
986 'label' => esc_html__( 'Icon Color', 'betterdocs' ),
987 'type' => Controls_Manager::COLOR,
988 'selectors' => [
989 '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-info-tab .betterdocs-tab-items span svg path' => 'fill: {{VALUE}};'
990 ]
991 ]
992 );
993
994 $this->add_group_control(
995 Group_Control_Border::get_type(),
996 [
997 'name' => 'search_modal_content_active_tab_border',
998 'label' => esc_html__( 'Border', 'betterdocs' ),
999 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-info-tab .betterdocs-tab-items.active'
1000 ]
1001 );
1002
1003 $this->add_control(
1004 'search_modal_content_list',
1005 [
1006 'label' => esc_html__( 'Content List', 'betterdocs' ),
1007 'type' => \Elementor\Controls_Manager::HEADING,
1008 'separator' => 'before',
1009 ]
1010 );
1011
1012 $this->add_group_control(
1013 Group_Control_Typography::get_type(),
1014 [
1015 'name' => 'search_modal_content_list_typography',
1016 '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'
1017 ]
1018 );
1019
1020 $this->add_responsive_control(
1021 'search_modal_content_list_color',
1022 [
1023 'label' => esc_html__( 'Color', 'betterdocs' ),
1024 'type' => Controls_Manager::COLOR,
1025 'selectors' => [
1026 '{{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}};'
1027 ]
1028 ]
1029 );
1030
1031 $this->add_control(
1032 'search_modal_content_list_icon_size',
1033 [
1034 'label' => __( 'Icon Size', 'betterdocs' ),
1035 'type' => Controls_Manager::SLIDER,
1036 'size_units' => [ 'px', '%' ],
1037 'range' => [
1038 'px' => [
1039 'min' => 0,
1040 'max' => 1000,
1041 'step' => 5
1042 ],
1043 '%' => [
1044 'min' => 0,
1045 'max' => 100
1046 ]
1047 ],
1048 'selectors' => [
1049 '{{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}};'
1050 ]
1051 ]
1052 );
1053
1054 $this->add_group_control(
1055 Group_Control_Border::get_type(),
1056 [
1057 'name' => 'search_modal_content_list_border',
1058 'label' => esc_html__( 'Border', 'betterdocs' ),
1059 'selector' => '{{WRAPPER}} .betterdocs-search-wrapper .betterdocs-search-details .betterdocs-search-content .betterdocs-search-items-wrapper .betterdocs-search-item-content .betterdocs-search-item-list'
1060 ]
1061 );
1062
1063 $this->add_control(
1064 'search_modal_content_list_category',
1065 [
1066 'label' => esc_html__( 'Content List Category', 'betterdocs' ),
1067 'type' => \Elementor\Controls_Manager::HEADING,
1068 'separator' => 'before',
1069 ]
1070 );
1071
1072 $this->add_group_control(
1073 Group_Control_Typography::get_type(),
1074 [
1075 'name' => 'search_modal_content_list_category_typography',
1076 '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'
1077 ]
1078 );
1079
1080 $this->add_responsive_control(
1081 'search_modal_content_list_category_color',
1082 [
1083 'label' => esc_html__( 'Color', 'betterdocs' ),
1084 'type' => Controls_Manager::COLOR,
1085 'selectors' => [
1086 '{{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}};'
1087 ]
1088 ]
1089 );
1090
1091 $this->add_control(
1092 'search_modal_content_list_category_icon_size',
1093 [
1094 'label' => __( 'Icon Size', 'betterdocs' ),
1095 'type' => Controls_Manager::SLIDER,
1096 'size_units' => [ 'px', '%' ],
1097 'range' => [
1098 'px' => [
1099 'min' => 0,
1100 'max' => 1000,
1101 'step' => 5
1102 ],
1103 '%' => [
1104 'min' => 0,
1105 'max' => 100
1106 ]
1107 ],
1108 'selectors' => [
1109 '{{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}};'
1110 ]
1111 ]
1112 );
1113
1114 $this->end_controls_section();
1115 }
1116
1117 public function search_result_box_layout_1() {
1118 /**
1119 * ----------------------------------------------------------
1120 * Section: Search Result Box
1121 * ----------------------------------------------------------
1122 */
1123 $this->start_controls_section(
1124 'section_search_result_settings',
1125 [
1126 'label' => __( 'Search Result Box', 'betterdocs' ),
1127 'tab' => Controls_Manager::TAB_STYLE,
1128 'condition' => [
1129 'layout_select' => 'layout-1'
1130 ]
1131 ]
1132 );
1133
1134 $this->add_responsive_control(
1135 'result_box_width',
1136 [
1137 'label' => __( 'Width', 'betterdocs' ),
1138 'type' => Controls_Manager::SLIDER,
1139 'default' => [
1140 'size' => 100,
1141 'unit' => '%'
1142 ],
1143 'size_units' => [ '%', 'px', 'em' ],
1144 'range' => [
1145 '%' => [
1146 'max' => 100,
1147 'step' => 1
1148 ]
1149 ],
1150 'selectors' => [
1151 '{{WRAPPER}} .betterdocs-live-search .docs-search-result' => 'width: {{SIZE}}{{UNIT}};'
1152 ]
1153 ]
1154 );
1155
1156 $this->add_responsive_control(
1157 'result_box_max_width',
1158 [
1159 'label' => __( 'Max Width', 'betterdocs' ),
1160 'type' => Controls_Manager::SLIDER,
1161 'default' => [
1162 'size' => 1600,
1163 'unit' => 'px'
1164 ],
1165 'size_units' => [ 'px', 'em' ],
1166 'range' => [
1167 'px' => [
1168 'max' => 1600,
1169 'step' => 1
1170 ]
1171 ],
1172 'selectors' => [
1173 '{{WRAPPER}} .betterdocs-live-search .docs-search-result' => 'max-width: {{SIZE}}{{UNIT}};'
1174 ]
1175 ]
1176 );
1177
1178 $this->add_group_control(
1179 Group_Control_Background::get_type(),
1180 [
1181 'name' => 'result_box_bg',
1182 'types' => [ 'classic', 'gradient' ],
1183 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result'
1184 ]
1185 );
1186
1187 $this->add_group_control(
1188 Group_Control_Border::get_type(),
1189 [
1190 'name' => 'result_box_border',
1191 'label' => esc_html__( 'Border', 'betterdocs' ),
1192 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result'
1193 ]
1194 );
1195
1196 $this->end_controls_section(); # end of 'Search Result Box'
1197 }
1198
1199 public function search_result_list_layout_1() {
1200 /**
1201 * ----------------------------------------------------------
1202 * Section: Search Result Item
1203 * ----------------------------------------------------------
1204 */
1205 $this->start_controls_section(
1206 'section_search_result_item_settings',
1207 [
1208 'label' => __( 'Search Result List', 'betterdocs' ),
1209 'tab' => Controls_Manager::TAB_STYLE,
1210 'condition' => [
1211 'layout_select' => 'layout-1'
1212 ]
1213 ]
1214 );
1215
1216 $this->start_controls_tabs( 'item_settings_tab' );
1217
1218 // Normal State Tab
1219 $this->start_controls_tab(
1220 'item_normal',
1221 [ 'label' => esc_html__( 'Normal', 'betterdocs' ) ]
1222 );
1223
1224 $this->add_control(
1225 'result_box_item',
1226 [
1227 'label' => esc_html__( 'Item', 'betterdocs' ),
1228 'type' => Controls_Manager::HEADING
1229 ]
1230 );
1231
1232 $this->add_group_control(
1233 Group_Control_Typography::get_type(),
1234 [
1235 'name' => 'result_box_item_typography',
1236 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li a .betterdocs-search-title'
1237 ]
1238 );
1239
1240 $this->add_control(
1241 'result_box_item_color',
1242 [
1243 'label' => esc_html__( 'Item Color', 'betterdocs' ),
1244 'type' => Controls_Manager::COLOR,
1245 'selectors' => [
1246 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li a .betterdocs-search-title' => 'color: {{VALUE}};'
1247 ]
1248 ]
1249 );
1250
1251 $this->add_group_control(
1252 Group_Control_Border::get_type(),
1253 [
1254 'name' => 'result_item_border',
1255 'label' => esc_html__( 'Border', 'betterdocs' ),
1256 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li'
1257 ]
1258 );
1259
1260 $this->add_responsive_control(
1261 'result_box_item_padding',
1262 [
1263 'label' => __( 'Padding', 'betterdocs' ),
1264 'type' => Controls_Manager::DIMENSIONS,
1265 'size_units' => [ 'px', 'em', '%' ],
1266 'selectors' => [
1267 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1268 ]
1269 ]
1270 );
1271
1272 $this->add_control(
1273 'search_result_box_item_category',
1274 [
1275 'label' => esc_html__( 'Category', 'betterdocs' ),
1276 'type' => Controls_Manager::HEADING,
1277 'separator' => 'before'
1278 ]
1279 );
1280
1281 $this->add_group_control(
1282 Group_Control_Typography::get_type(),
1283 [
1284 'name' => 'result_box_item_category_typography',
1285 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li span.betterdocs-search-category'
1286 ]
1287 );
1288
1289 $this->add_control(
1290 'result_box_item_category_color',
1291 [
1292 'label' => esc_html__( 'Color', 'betterdocs' ),
1293 'type' => Controls_Manager::COLOR,
1294 'selectors' => [
1295 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li span.betterdocs-search-category' => 'color: {{VALUE}};'
1296 ]
1297 ]
1298 );
1299
1300 $this->end_controls_tab();
1301
1302 // Hover State Tab
1303 $this->start_controls_tab(
1304 'item_hover',
1305 [ 'label' => esc_html__( 'Hover', 'betterdocs' ) ]
1306 );
1307
1308 $this->add_responsive_control(
1309 'result_item_transition',
1310 [
1311 'label' => __( 'Transition', 'betterdocs' ),
1312 'type' => Controls_Manager::SLIDER,
1313 'default' => [
1314 'size' => 300,
1315 'unit' => '%'
1316 ],
1317 'size_units' => [ '%' ],
1318 'range' => [
1319 '%' => [
1320 'max' => 2500,
1321 'step' => 1
1322 ]
1323 ],
1324 'selectors' => [
1325 '{{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;'
1326 ]
1327 ]
1328 );
1329
1330 $this->add_control(
1331 'result_box_item_hover_heading',
1332 [
1333 'label' => esc_html__( 'Item', 'betterdocs' ),
1334 'type' => Controls_Manager::HEADING
1335 ]
1336 );
1337
1338 $this->add_group_control(
1339 Group_Control_Background::get_type(),
1340 [
1341 'name' => 'result_box_item_hover_bg',
1342 'types' => [ 'classic', 'gradient' ],
1343 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover',
1344 'exclude' => [
1345 'image'
1346 ]
1347 ]
1348 );
1349
1350 $this->add_control(
1351 'result_box_item_hover_color',
1352 [
1353 'label' => esc_html__( 'Item Color', 'betterdocs' ),
1354 'type' => Controls_Manager::COLOR,
1355 'selectors' => [
1356 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover a' => 'color: {{VALUE}};'
1357 ]
1358 ]
1359 );
1360
1361 $this->add_group_control(
1362 Group_Control_Border::get_type(),
1363 [
1364 'name' => 'result_item_hover_border',
1365 'label' => esc_html__( 'Border', 'betterdocs' ),
1366 'selector' => '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover'
1367 ]
1368 );
1369
1370 $this->add_control(
1371 'result_box_item_hover_count_heading',
1372 [
1373 'label' => esc_html__( 'Count', 'betterdocs' ),
1374 'type' => Controls_Manager::HEADING,
1375 'separator' => 'before'
1376 ]
1377 );
1378
1379 $this->add_control(
1380 'result_box_item_hover_count_color',
1381 [
1382 'label' => esc_html__( 'Item Color', 'betterdocs' ),
1383 'type' => Controls_Manager::COLOR,
1384 'selectors' => [
1385 '{{WRAPPER}} .betterdocs-live-search .docs-search-result li:hover span' => 'color: {{VALUE}};'
1386 ]
1387 ]
1388 );
1389 $this->end_controls_tab();
1390 $this->end_controls_tabs();
1391
1392 $this->end_controls_section(); # end of 'Search Result Item'
1393
1394 do_action( 'betterdocs/elementor/widgets/advanced-search/controllers', $this );
1395 }
1396
1397 public function render_callback() {
1398 $settings = &$this->attributes;
1399 if ( $settings['layout_select'] == 'layout-1' ) {
1400 $this->views( 'widgets/search-form' );
1401 } else {
1402 $number_of_docs = isset( $settings['initial_docs_number'] ) ? $settings['initial_docs_number'] : '';
1403 $number_of_faqs = isset( $settings['initial_faqs_number'] ) ? $settings['initial_faqs_number'] : '';
1404 $doc_categories_ids = isset( $settings['search_modal_query_term_ids'] ) ? $settings['search_modal_query_term_ids'] : '';
1405 $doc_ids = isset( $settings['search_modal_query_doc_ids'] ) ? $settings['search_modal_query_doc_ids'] : '';
1406 $faq_categories_ids = isset( $settings['search_modal_query_faq_term_ids'] ) ? $settings['search_modal_query_faq_term_ids'] : '';
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 ) . '"]' );
1410 }
1411 }
1412
1413 public function view_params() {
1414 $settings = &$this->attributes;
1415
1416 $popular_search_title = isset( $settings['advance_search_popular_search_title_placeholder'] ) ? $settings['advance_search_popular_search_title_placeholder'] : '';
1417 $category_search_toggle = isset( $settings['betterdocs_category_search_toogle'] ) ? $settings['betterdocs_category_search_toogle'] : '';
1418 $search_button_toggle = isset( $settings['betterdocs_search_button_toogle'] ) ? $settings['betterdocs_search_button_toogle'] : true;
1419 $popular_search_toggle = isset( $settings['betterdocs_popular_search_toogle'] ) ? $settings['betterdocs_popular_search_toogle'] : '';
1420
1421 $_shortcode_attributes = apply_filters(
1422 'betterdocs_elementor_search_form_params',
1423 [
1424 'enable_heading' => 'true',
1425 'popular_search_title' => $popular_search_title,
1426 'category_search' => $category_search_toggle,
1427 'search_button' => $search_button_toggle,
1428 'popular_search' => $popular_search_toggle,
1429 'heading' => esc_html( $settings['section_search_field_heading'] ),
1430 'subheading' => esc_html( $settings['section_search_field_sub_heading'] ),
1431 'placeholder' => esc_html( $settings['section_search_field_placeholder'] )
1432 ],
1433 $this->attributes
1434 );
1435
1436 return [
1437 'shortcode_attr' => $_shortcode_attributes
1438 ];
1439 }
1440
1441 // In plain mode, render without shortcode
1442 public function render_plain_content() {
1443 $settings = $this->get_settings_for_display();
1444 echo '[betterdocs_search_form placeholder="' . esc_attr( $settings['section_search_field_placeholder'] ) . '"]';
1445 }
1446 }
1447