PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.4
Shortcodes and extra features for Phlox theme v2.17.4
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elementor / widgets / theme-elements / modern-search.php
auxin-elements / includes / elementor / widgets / theme-elements Last commit date
breadcrumbs.php 1 year ago copyright.php 1 year ago current-time.php 1 year ago logo.php 1 year ago menu.php 1 year ago modern-search.php 1 year ago search.php 1 year ago select.php 1 year ago shopping-cart.php 1 year ago site-title.php 1 year ago
modern-search.php
1125 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Elements\Theme_Elements;
3
4 use Elementor\Widget_Base;
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Typography;
7 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
8 use Elementor\Group_Control_Text_Shadow;
9 use Elementor\Group_Control_Background;
10 use Elementor\Group_Control_Box_Shadow;
11 use Elementor\Group_Control_Border;
12
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 /**
19 * Elementor 'ModernSearch' widget.
20 *
21 * Elementor widget that displays an 'ModernSearch'.
22 *
23 * @since 1.0.0
24 */
25 class ModernSearch extends Widget_Base {
26
27 /**
28 * Get widget name.
29 *
30 * Retrieve 'ModernSearch' widget name.
31 *
32 * @since 1.0.0
33 * @access public
34 *
35 * @return string Widget name.
36 */
37 public function get_name() {
38 return 'aux_modern_search';
39 }
40
41 /**
42 * Get widget title.
43 *
44 * Retrieve 'ModernSearch' widget title.
45 *
46 * @since 1.0.0
47 * @access public
48 *
49 * @return string Widget title.
50 */
51 public function get_title() {
52 return __('Modern Search', 'auxin-elements' );
53 }
54
55 /**
56 * Get widget icon.
57 *
58 * Retrieve 'ModernSearch' widget icon.
59 *
60 * @since 1.0.0
61 * @access public
62 *
63 * @return string Widget icon.
64 */
65 public function get_icon() {
66 return 'eicon-search auxin-badge';
67 }
68
69 /**
70 * Get widget categories.
71 *
72 * Retrieve 'ModernSearch' widget icon.
73 *
74 * @since 1.0.0
75 * @access public
76 *
77 * @return string Widget icon.
78 */
79 public function get_categories() {
80 return [ 'auxin-core', 'auxin-theme-elements' ];
81 }
82
83 /**
84 * Register 'ModernSearch' widget controls.
85 *
86 * Adds different input fields to allow the user to change and customize the widget settings.
87 *
88 * @since 1.0.0
89 * @access protected
90 */
91 protected function register_controls() {
92
93 /* Search Section
94 /*-------------------------------------*/
95
96 $this->start_controls_section(
97 'section_search',
98 [
99 'label' => __( 'Button', 'auxin-elements' ),
100 ]
101 );
102
103 $this->add_control(
104 'icon',
105 [
106 'label' => __( 'Icon', 'auxin-elements' ),
107 'type' => Controls_Manager::ICONS,
108 'default' => [
109 'value' => 'auxicon-search-4',
110 'library' => 'auxicon'
111 ]
112 ]
113 );
114
115 $this->add_control(
116 'text',
117 [
118 'label' => __( 'Text', 'auxin-elements' ),
119 'type' => Controls_Manager::TEXT,
120 'dynamic' => [
121 'active' => true,
122 ],
123 'default' => '',
124 'placeholder' => __( 'Submit', 'auxin-elements' ),
125 ]
126 );
127
128 $this->end_controls_section();
129
130 /* Search Section
131 /*-------------------------------------*/
132
133 $this->start_controls_section(
134 'fullscreen',
135 [
136 'label' => __( 'Fullscreen Search Input', 'auxin-elements' ),
137 ]
138 );
139
140 $this->add_control(
141 'post_types',
142 [
143 'label' => __('Post Types', 'auxin-elements'),
144 'description' => __('Specifies a post type that you want to show posts from it.', 'auxin-elements' ),
145 'type' => Controls_Manager::SELECT2,
146 'multiple' => true,
147 'options' => $this->get_post_types(),
148 'default' => [ 'post' ],
149 ]
150 );
151
152 $this->add_control(
153 'use_ajax',
154 [
155 'label' => __( 'Enable Ajax Search', 'auxin-elements' ),
156 'type' => Controls_Manager::SWITCHER,
157 'label_on' => __( 'On', 'auxin-elements' ),
158 'label_off' => __( 'Off', 'auxin-elements' ),
159 'return_value' => 'yes',
160 'default' => 'yes',
161 'separator' => 'before'
162 ]
163 );
164
165 $this->add_control(
166 'fullscreen_display_submit',
167 [
168 'label' => __( 'Display Submit Button', 'auxin-elements' ),
169 'type' => Controls_Manager::SWITCHER,
170 'label_on' => __( 'On', 'auxin-elements' ),
171 'label_off' => __( 'Off', 'auxin-elements' ),
172 'return_value' => 'yes',
173 'default' => 'yes',
174 'separator' => 'before'
175 ]
176 );
177
178 $this->add_control(
179 'fullscreen_display_fill_submit',
180 [
181 'label' => __( 'Display Fill Submit Button', 'auxin-elements' ),
182 'type' => Controls_Manager::SWITCHER,
183 'label_on' => __( 'On', 'auxin-elements' ),
184 'label_off' => __( 'Off', 'auxin-elements' ),
185 'return_value' => 'yes',
186 'default' => 'no',
187 'separator' => 'before',
188 'condition' => [
189 'fullscreen_display_submit' => 'yes'
190 ]
191 ]
192 );
193
194 $this->add_control(
195 'fullscreen_display_cats',
196 [
197 'label' => __( 'Display Categories', 'auxin-elements' ),
198 'type' => Controls_Manager::SWITCHER,
199 'label_on' => __( 'On', 'auxin-elements' ),
200 'label_off' => __( 'Off', 'auxin-elements' ),
201 'return_value' => 'yes',
202 'default' => 'no',
203 'separator' => 'before'
204 ]
205 );
206
207 $this->add_control(
208 'search_field_placeholder_text',
209 [
210 'label' => __( 'Custom Placeholder Text', 'auxin-elements' ),
211 'type' => Controls_Manager::TEXT,
212 'default' => '',
213 'placeholder' => __( 'Search ...', 'auxin-elements' ),
214 ]
215 );
216
217 $this->add_control(
218 'search_field_title',
219 [
220 'label' => __( 'Search Title', 'auxin-elements' ),
221 'type' => Controls_Manager::TEXT,
222 'default' => '',
223 'placeholder' => __( 'Type to Search', 'auxin-elements' ),
224 ]
225 );
226
227
228 $this->end_controls_section();
229
230 /* Icon Style Section
231 /*-------------------------------------*/
232
233 $this->start_controls_section(
234 'icon_style_section',
235 [
236 'label' => __( 'Icon', 'auxin-elements' ),
237 'tab' => Controls_Manager::TAB_STYLE
238 ]
239 );
240
241 $this->start_controls_tabs( 'icon_styles' );
242
243 $this->start_controls_tab(
244 'icon_style_normal',
245 [
246 'label' => __( 'Normal' , 'auxin-elements' )
247 ]
248 );
249
250 $this->add_control(
251 'icon_color_normal',
252 [
253 'label' => __( 'Color', 'auxin-elements' ),
254 'type' => Controls_Manager::COLOR,
255 'selectors' => [
256 '{{WRAPPER}} .aux-search-submit svg' => 'color: {{VALUE}}; fill: {{VALUE}};'
257 ]
258 ]
259 );
260
261 $this->add_responsive_control(
262 'icon_size_normal',
263 [
264 'label' => __( 'Size', 'auxin-elements' ),
265 'type' => Controls_Manager::SLIDER,
266 'size_units' => [ 'px', '%' ],
267 'range' => [
268 'px' => [
269 'min' => 16,
270 'max' => 512,
271 'step' => 2,
272 ],
273 '%' => [
274 'min' => 0,
275 'max' => 100,
276 ],
277 ],
278 'default' => [
279 'size' => 22,
280 'unit' => 'px'
281 ],
282 'selectors' => [
283 '{{WRAPPER}} .aux-search-submit svg' => 'font-size: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
284 ],
285 ]
286 );
287
288 $this->end_controls_tab();
289
290 $this->start_controls_tab(
291 'icon_style_hover',
292 [
293 'label' => __( 'Hover' , 'auxin-elements' )
294 ]
295 );
296
297 $this->add_control(
298 'icon_color_hover',
299 [
300 'label' => __( 'Color', 'auxin-elements' ),
301 'type' => Controls_Manager::COLOR,
302 'selectors' => [
303 '{{WRAPPER}} .aux-search-submit:hover svg' => 'color: {{VALUE}};fill: {{VALUE}};'
304 ]
305 ]
306 );
307
308 $this->add_responsive_control(
309 'icon_size_hover',
310 [
311 'label' => __( 'Size', 'auxin-elements' ),
312 'type' => Controls_Manager::SLIDER,
313 'size_units' => [ 'px', '%' ],
314 'range' => [
315 'px' => [
316 'min' => 16,
317 'max' => 512,
318 'step' => 2,
319 ],
320 '%' => [
321 'min' => 0,
322 'max' => 100,
323 ],
324 ],
325 'selectors' => [
326 '{{WRAPPER}} .aux-search-submit:hover svg' => 'font-size: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};',
327 ],
328 ]
329 );
330
331 $this->end_controls_tab();
332
333 $this->end_controls_tabs();
334
335 $this->end_controls_section();
336
337 /* Text Style Section
338 /*-------------------------------------*/
339 $this->start_controls_section(
340 'text_style_section',
341 [
342 'label' => __( 'Text', 'auxin-elements' ),
343 'tab' => Controls_Manager::TAB_STYLE,
344 'condition' => ['text!' => '']
345 ]
346 );
347
348 $this->start_controls_tabs( 'text_styles' );
349
350 $this->start_controls_tab(
351 'text_style_normal',
352 [
353 'label' => __( 'Normal' , 'auxin-elements' )
354 ]
355 );
356
357 $this->add_control(
358 'text_color_normal',
359 [
360 'label' => __( 'Color', 'auxin-elements' ),
361 'type' => Controls_Manager::COLOR,
362 'selectors' => [
363 '{{WRAPPER}} .aux-search-submit' => 'color: {{VALUE}};'
364 ]
365 ]
366 );
367
368 $this->add_group_control(
369 Group_Control_Typography::get_type(),
370 [
371 'name' => 'text_typo_normal',
372 'global' => [
373 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
374 ],
375 'selector' => '{{WRAPPER}} .aux-search-submit'
376 ]
377 );
378
379 $this->add_group_control(
380 Group_Control_Text_Shadow::get_type(),
381 [
382 'name' => 'text_text_shadow_normal',
383 'selector' => '{{WRAPPER}} .aux-search-submit'
384 ]
385 );
386
387 $this->end_controls_tab();
388
389 $this->start_controls_tab(
390 'text_style_hover',
391 [
392 'label' => __( 'Hover' , 'auxin-elements' )
393 ]
394 );
395
396 $this->add_control(
397 'text_color_hover',
398 [
399 'label' => __( 'Color', 'auxin-elements' ),
400 'type' => Controls_Manager::COLOR,
401 'selectors' => [
402 '{{WRAPPER}} .aux-search-submit:hover' => 'color: {{VALUE}};'
403 ]
404 ]
405 );
406
407 $this->add_group_control(
408 Group_Control_Typography::get_type(),
409 [
410 'name' => 'text_typo_hover',
411 'global' => [
412 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
413 ],
414 'selector' => '{{WRAPPER}} .aux-search-submit:hover'
415 ]
416 );
417
418 $this->add_group_control(
419 Group_Control_Text_Shadow::get_type(),
420 [
421 'name' => 'text_text_shadow_hover',
422 'selector' => '{{WRAPPER}} .aux-search-submit:hover'
423 ]
424 );
425
426 $this->end_controls_tab();
427
428 $this->end_controls_tabs();
429
430 $this->end_controls_section();
431
432 /* Button Style Section
433 /*-------------------------------------*/
434
435 $this->start_controls_section(
436 'button_style_section',
437 [
438 'label' => __( 'Button', 'auxin-elements' ),
439 'tab' => Controls_Manager::TAB_STYLE,
440 ]
441 );
442
443 $this->start_controls_tabs( 'button_styles' );
444
445 $this->start_controls_tab(
446 'button_style_normal',
447 [
448 'label' => __( 'Normal' , 'auxin-elements' )
449 ]
450 );
451
452 $this->add_group_control(
453 Group_Control_Background::get_type(),
454 [
455 'name' => 'button_bg_normal',
456 'selector' => '{{WRAPPER}} .aux-search-submit',
457 'types' => [ 'classic', 'gradient'],
458 'separator' => 'after'
459 ]
460 );
461
462 $this->add_responsive_control(
463 'button_padding_normal',
464 [
465 'label' => __( 'Padding', 'auxin-elements' ),
466 'type' => Controls_Manager::DIMENSIONS,
467 'size_units' => [ 'px', '%' ],
468 'selectors' => [
469 '{{WRAPPER}} .aux-search-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
470 ],
471 'separator' => 'before'
472 ]
473 );
474
475 $this->add_group_control(
476 Group_Control_Border::get_type(),
477 [
478 'name' => 'button_border_normal',
479 'selector' => '{{WRAPPER}} .aux-search-submit',
480 'separator' => 'none',
481 'separator' => 'before'
482 ]
483 );
484
485 $this->add_responsive_control(
486 'button_border_radius_normal',
487 [
488 'label' => __( 'Border Radius', 'auxin-elements' ),
489 'type' => Controls_Manager::DIMENSIONS,
490 'size_units' => [ 'px', 'em', '%' ],
491 'allowed_dimensions' => 'all',
492 'separator' => 'before',
493 'selectors' => [
494 '{{WRAPPER}} .aux-search-submit' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
495 ],
496 ]
497 );
498
499 $this->add_group_control(
500 Group_Control_Box_Shadow::get_type(),
501 [
502 'name' => 'button_box_shadow_normal',
503 'selector' => '{{WRAPPER}} .aux-search-submit',
504 'separator' => 'before'
505 ]
506 );
507
508 $this->end_controls_tab();
509
510 $this->start_controls_tab(
511 'button_style_hover',
512 [
513 'label' => __( 'Hover' , 'auxin-elements' )
514 ]
515 );
516
517 $this->add_group_control(
518 Group_Control_Background::get_type(),
519 [
520 'name' => 'button_bg_hover',
521 'selector' => '{{WRAPPER}} .aux-search-submit:hover',
522 'types' => [ 'classic', 'gradient'],
523 'separator' => 'after'
524 ]
525 );
526
527 $this->add_responsive_control(
528 'button_padding_hover',
529 [
530 'label' => __( 'Padding', 'auxin-elements' ),
531 'type' => Controls_Manager::DIMENSIONS,
532 'size_units' => [ 'px', '%' ],
533 'selectors' => [
534 '{{WRAPPER}} .aux-search-submit:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
535 ],
536 'separator' => 'before'
537 ]
538 );
539
540 $this->add_group_control(
541 Group_Control_Border::get_type(),
542 [
543 'name' => 'button_border_hover',
544 'selector' => '{{WRAPPER}} .aux-search-submit:hover',
545 'separator' => 'before'
546 ]
547 );
548
549 $this->add_responsive_control(
550 'button_border_radius_hover',
551 [
552 'label' => __( 'Border Radius', 'auxin-elements' ),
553 'type' => Controls_Manager::DIMENSIONS,
554 'size_units' => [ 'px', 'em', '%' ],
555 'selectors' => [
556 '{{WRAPPER}} .aux-search-submit:hover' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
557 ],
558 'allowed_dimensions' => 'all',
559 'separator' => 'before'
560 ]
561 );
562 $this->add_group_control(
563 Group_Control_Box_Shadow::get_type(),
564 [
565 'name' => 'button_box_shadow_hover',
566 'selector' => '{{WRAPPER}} .aux-search-submit:hover',
567 'separator' => 'before'
568 ]
569 );
570
571 $this->end_controls_tab();
572
573 $this->end_controls_tabs();
574
575 $this->add_control(
576 'button_cursor',
577 [
578 'label' => __( 'Cursor', 'auxin-elements' ),
579 'type' => Controls_Manager::SELECT,
580 'options' => [
581 'default' => __( 'Default', 'auxin-elements' ),
582 'pointer' => __( 'Pointer', 'auxin-elements' ),
583 'zoom-in' => __( 'Zoom', 'auxin-elements' ),
584 'help' => __( 'Help', 'auxin-elements' )
585 ],
586 'default' => 'pointer',
587 'selectors' => [
588 '{{WRAPPER}} .aux-search-submit' => 'cursor: {{VALUE}};'
589 ],
590 'separator' => 'before'
591 ]
592 );
593
594 $this->end_controls_section();
595
596 /* Input Style Section
597 /*-------------------------------------*/
598
599 $this->start_controls_section(
600 'input_style_section',
601 [
602 'label' => __( 'Fullscreen Search Input', 'auxin-elements' ),
603 'tab' => Controls_Manager::TAB_STYLE
604 ]
605 );
606
607
608 $this->add_control(
609 'input_color',
610 [
611 'label' => __( 'Text Color', 'auxin-elements' ),
612 'type' => Controls_Manager::COLOR,
613 'selectors' => [
614 '{{WRAPPER}} .aux-search-popup .aux-search-field' => 'color: {{VALUE}};'
615 ]
616 ]
617 );
618
619 $this->add_control(
620 'input_placeholder_color',
621 [
622 'label' => __( 'Placeholder Text Color', 'auxin-elements' ),
623 'type' => Controls_Manager::COLOR,
624 'selectors' => [
625 '{{WRAPPER}} .aux-search-popup .aux-search-field::placeholder' => 'color:{{VALUE}};'
626 ],
627 'separator' => 'after'
628 ]
629 );
630
631 $this->add_group_control(
632 Group_Control_Typography::get_type(),
633 [
634 'name' => 'input_typo',
635 'global' => [
636 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
637 ],
638 'selector' => '{{WRAPPER}} .aux-search-popup .aux-search-field',
639 'separator' => 'before'
640 ]
641 );
642
643 $this->add_responsive_control(
644 'input_padding',
645 [
646 'label' => __( 'Padding', 'auxin-elements' ),
647 'type' => Controls_Manager::DIMENSIONS,
648 'size_units' => [ 'px', '%' ],
649 'selectors' => [
650 '{{WRAPPER}} .aux-search-popup .aux-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
651 ],
652 'separator' => 'before'
653 ]
654 );
655
656 $this->add_responsive_control(
657 'input_border_size',
658 [
659 'label' => __( 'Border Size', 'auxin-elements' ),
660 'type' => Controls_Manager::SLIDER,
661 'size_units' => [ 'px' ],
662 'range' => [
663 'px' => [
664 'min' => 0,
665 'max' => 20,
666 'step' => 1,
667 ],
668 ],
669 'default' => [
670 'size' => 2,
671 'unit' => 'px'
672 ],
673 'selectors' => [
674 '{{WRAPPER}} .aux-search-popup .aux-search-input-form' => 'border-width: {{SIZE}}{{UNIT}};',
675 ],
676 'separator' => 'before'
677 ]
678 );
679
680 $this->add_control(
681 'input_border_color',
682 [
683 'label' => __( 'Border Color', 'auxin-elements' ),
684 'type' => Controls_Manager::COLOR,
685 'selectors' => [
686 '{{WRAPPER}} .aux-search-popup .aux-search-input-form' => 'border-color: {{VALUE}};'
687 ],
688 'separator' => 'before'
689 ]
690 );
691
692 $this->add_control(
693 'input_icon_enabled',
694 array(
695 'label' => __( 'Display Search Icon', 'auxin-elements' ),
696 'type' => Controls_Manager::SWITCHER,
697 'label_on' => __( 'Show', 'auxin-elements' ),
698 'label_off' => __( 'Hide', 'auxin-elements' ),
699 'default' => 'yes',
700 'separator' => 'before'
701 )
702 );
703
704 $this->add_responsive_control(
705 'input_icon_size',
706 [
707 'label' => __( 'Search Icon Size', 'auxin-elements' ),
708 'type' => Controls_Manager::SLIDER,
709 'size_units' => [ 'px', '%' ],
710 'range' => [
711 'px' => [
712 'min' => 16,
713 'max' => 512,
714 'step' => 2,
715 ],
716 '%' => [
717 'min' => 0,
718 'max' => 100,
719 ],
720 ],
721 'default' => [
722 'size' => 30,
723 'unit' => 'px'
724 ],
725 'selectors' => [
726 '{{WRAPPER}} .aux-search-popup .aux-submit-icon-container:before' => 'font-size: {{SIZE}}{{UNIT}};',
727 ],
728 'condition' => [
729 'input_icon_enabled' => 'yes'
730 ]
731 ]
732 );
733
734 $this->add_control(
735 'input_icon_color',
736 [
737 'label' => __( 'Search Icon Color', 'auxin-elements' ),
738 'type' => Controls_Manager::COLOR,
739 'selectors' => [
740 '{{WRAPPER}} .aux-search-popup .aux-submit-icon-container:before' => 'color: {{VALUE}} !important;'
741 ],
742 'condition' => [
743 'input_icon_enabled' => 'yes'
744 ]
745 ]
746 );
747
748 $this->add_group_control(
749 Group_Control_Background::get_type(),
750 [
751 'name' => 'input_bg',
752 'selector' => '{{WRAPPER}} .aux-search-popup',
753 'types' => [ 'classic', 'gradient'],
754 'separator' => 'before',
755 'fields_options' => [
756 'background' => [
757 'label' => __( 'Overlay Background', 'auxin-elements' ),
758 ]
759 ]
760 ]
761 );
762
763 $this->end_controls_section();
764
765 /* Input Style Section
766 /*-------------------------------------*/
767
768 $this->start_controls_section(
769 'close_style_section',
770 [
771 'label' => __( 'Fullscreen Close Button', 'auxin-elements' ),
772 'tab' => Controls_Manager::TAB_STYLE
773 ]
774 );
775
776 $this->add_responsive_control(
777 'close_position_top',
778 [
779 'label' => __('Top Position','auxin-elements' ),
780 'type' => Controls_Manager::SLIDER,
781 'size_units' => ['px', 'em', '%'],
782 'range' => [
783 'px' => [
784 'min' => -2000,
785 'max' => 2000,
786 'step' => 1
787 ],
788 '%' => [
789 'min' => -100,
790 'max' => 100,
791 'step' => 1
792 ],
793 'em' => [
794 'min' => -150,
795 'max' => 150,
796 'step' => 1
797 ]
798 ],
799 'selectors' => [
800 '{{WRAPPER}} .aux-search-popup .aux-panel-close' => 'top:{{SIZE}}{{UNIT}};'
801 ],
802 ]
803 );
804
805 $this->add_responsive_control(
806 'close_position_right',
807 [
808 'label' => __('Right Position','auxin-elements' ),
809 'type' => Controls_Manager::SLIDER,
810 'size_units' => ['px', 'em', '%'],
811 'range' => [
812 'px' => [
813 'min' => -2000,
814 'max' => 2000,
815 'step' => 1
816 ],
817 '%' => [
818 'min' => -100,
819 'max' => 100,
820 'step' => 1
821 ],
822 'em' => [
823 'min' => -150,
824 'max' => 150,
825 'step' => 1
826 ]
827 ],
828 'selectors' => [
829 '{{WRAPPER}} .aux-search-popup .aux-panel-close' => 'right:{{SIZE}}{{UNIT}};'
830 ]
831 ]
832 );
833
834 $this->end_controls_section();
835
836
837 /* Search Title Style
838 /*-------------------------------------*/
839
840 $this->start_controls_section(
841 'title_style_section',
842 [
843 'label' => __( 'Search Title', 'auxin-elements' ),
844 'tab' => Controls_Manager::TAB_STYLE,
845 'condition' => [
846 'search_field_title!' => ''
847 ]
848 ]
849 );
850
851
852 $this->add_control(
853 'title_color',
854 [
855 'label' => __( 'Title Color', 'auxin-elements' ),
856 'type' => Controls_Manager::COLOR,
857 'selectors' => [
858 '{{WRAPPER}} .aux-search-form-legend' => 'color:{{VALUE}};'
859 ]
860 ]
861 );
862
863 $this->add_group_control(
864 Group_Control_Typography::get_type(),
865 [
866 'name' => 'title_typo',
867 'global' => [
868 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
869 ],
870 'selector' => '{{WRAPPER}} .aux-search-form-legend'
871 ]
872 );
873
874 $this->add_responsive_control(
875 'title_margin',
876 [
877 'label' => __( 'Margin', 'auxin-elements' ),
878 'type' => Controls_Manager::DIMENSIONS,
879 'size_units' => [ 'px', '%' ],
880 'selectors' => [
881 '{{WRAPPER}} .aux-search-form-legend' => 'margin:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
882 ]
883 ]
884 );
885
886 $this->add_group_control(
887 Group_Control_Background::get_type(),
888 [
889 'name' => 'title_bg',
890 'selector' => '{{WRAPPER}} .aux-search-form-legend',
891 'types' => [ 'classic', 'gradient'],
892 'separator' => 'before'
893 ]
894 );
895
896 $this->end_controls_section();
897 }
898
899 /**
900 * Render Search Input.
901 *
902 * Render button widget text.
903 *
904 * @since 1.5.0
905 * @access protected
906 */
907 protected function render_search_button( $args = [] ) { ;
908
909 $defaults = [
910 'submit_class' => 'aux-search-submit aux-search-fullscreen',
911 'submit_text' => '',
912 'wrapper_class' => 'aux-modern-search-wrapper',
913 'icon' => 'auxicon-search-4',
914 'target' => '.aux-search-popup-' . $this->get_id(),
915 'use_ajax' => false
916 ];
917
918 $args = wp_parse_args( $args, $defaults );
919
920 $this->add_render_attribute( 'wrapper', 'class', $args['wrapper_class'] );
921 $this->add_render_attribute( 'button', 'class', $args['submit_class'] );
922 $this->add_render_attribute( 'button', 'data-target', $args['target'] );
923 $this->add_render_attribute( 'submit_text', 'class', 'aux-submit-text' );
924 if ( empty( $args['icon']['library'] ) || $args['icon']['library'] != 'svg' ) {
925 $this->add_render_attribute( 'icon', 'class', $args['icon'] );
926 }
927 ?>
928 <div <?php echo $this->get_render_attribute_string( 'wrapper' );?> >
929 <button <?php echo $this->get_render_attribute_string( 'button' );?> >
930 <?php if ( empty( $args['icon']['library'] ) || $args['icon']['library'] != 'svg' ) {
931 echo \Elementor\Icons_Manager::render_font_icon( $args['icon'], [ 'aria-hidden' => 'true' ] );
932 } else { ?>
933 <img src="<?php echo esc_url( $args['icon']['value']['url'] ); ?>">
934 <?php } ?>
935 <span <?php echo $this->get_render_attribute_string( 'submit_text' );?> ><?php echo esc_html( $args['submit_text'] ); ?></span>
936 </button>
937 </div>
938 <?php
939
940 }
941 /**
942 * Render Search Overlay.
943 *
944 * Render button widget text.
945 *
946 * @since 1.5.0
947 * @access protected
948 */
949 protected function render_search_overlay( $args = [] ) { ;
950
951 $defaults = [
952 'wrapper_class' => 'aux-search-popup aux-search-popup-' . $this->get_id(),
953 'use_ajax' => false,
954 'post_types' => [],
955 'placeholder_text' => __('Search...', 'auxin-elements' ),
956 'search_title' => ''
957 ];
958
959 $args = wp_parse_args( $args, $defaults );
960
961 $form_args = [
962 'use_ajax' => $args['use_ajax'],
963 'display_submit' => $args['display_submit'],
964 'display_fill' => $args['display_fill'],
965 'display_cats' => $args['display_cats'],
966 'post_types' => $args['post_types'],
967 'placeholder_text' => $args['placeholder_text'],
968 'search_title' => $args['search_title']
969 ];
970
971 $this->add_render_attribute( 'overlay_wrapper', 'class', $args['wrapper_class'] );
972 ?>
973 <div <?php echo $this->get_render_attribute_string( 'overlay_wrapper' );?>>
974 <div class="aux-panel-close">
975 <div class="aux-close aux-cross-symbol aux-thick-medium"></div>
976 </div>
977 <div class="aux-search-popup-content">
978 <?php $this->render_search_form( $form_args ) ;?>
979 <?php if ( $args['use_ajax'] ) { ;?>
980 <div class="aux-search-ajax-container">
981 <div class="aux-search-ajax-output"></div>
982 <div class="aux-loading-spinner aux-spinner-hide">
983 <div class="aux-loading-loop">
984 <svg class="aux-circle" width="100%" height="100%" viewBox="0 0 42 42">
985 <circle class="aux-stroke-bg" r="20" cx="21" cy="21" fill="none"></circle>
986 <circle class="aux-progress" r="20" cx="21" cy="21" fill="none" transform="rotate(-90 21 21)"></circle>
987 </svg>
988 </div>
989 </div>
990 </div>
991 <?php };?>
992 </div>
993 </div>
994 <?php
995 }
996
997 /**
998 * Render Search Overlay.
999 *
1000 * Render button widget text.
1001 *
1002 * @since 1.5.0
1003 * @access protected
1004 */
1005 protected function render_search_form( $args = [] ) { ;
1006
1007 $defaults = [
1008 'wrapper_class' => 'aux-search-form',
1009 'use_ajax' => false,
1010 'display_submit' => true,
1011 'display_fill' => false,
1012 'display_cats' => false,
1013 'post_types' => [],
1014 'placeholder_text' => __('Search...', 'auxin-elements' ),
1015 'search_title' => ''
1016 ];
1017
1018 $args = wp_parse_args( $args, $defaults );
1019
1020 $this->add_render_attribute( 'form_wrapper', 'class', $args['wrapper_class'] );
1021
1022 if ( $args['use_ajax'] ) {
1023 $this->add_render_attribute( 'form_wrapper', 'class', 'aux-search-ajax' );
1024 }
1025 ?>
1026 <div <?php echo $this->get_render_attribute_string( 'form_wrapper' );?>>
1027 <?php if( ! empty( $args['search_title'] ) ){
1028 echo '<h5 class="aux-search-form-legend">'. esc_html( $args['search_title'] ) .'</h5>';
1029 } ?>
1030 <form action="<?php echo esc_url( home_url( '/' ) ); ?>" method="get" >
1031 <div class="aux-search-input-form">
1032 <input type="text" class="aux-search-field" placeholder="<?php echo esc_attr( $args['placeholder_text'] ); ?>" name="s" autocomplete="off" data-post-types="<?php echo esc_attr ( wp_json_encode( $args['post_types'] ) ) ;?>" />
1033 <input type="hidden" name='post_type' value="<?php echo esc_attr( implode( ',', $args['post_types'] ) );?>">
1034 <?php if ( $args['display_cats'] ) { ;?>
1035 <?php $this->render_category( ['post_types' => $args['post_types'] ] );?>
1036 <?php };?>
1037 <?php if ( $args['display_submit'] ) { ;?>
1038 <?php if ( $args['display_fill'] ) { ;?>
1039 <input type="submit" class="aux-fill-search-submit" value="<?php esc_attr_e( 'Search', 'auxin-elements' ); ?> " >
1040 <?php } else { ;?>
1041 <div class="aux-submit-icon-container auxicon-search-4">
1042 <input type="submit" class="aux-iconic-search-submit" value="<?php esc_attr_e( 'Search', 'auxin-elements' ); ?>" >
1043 </div>
1044 <?php };?>
1045 <?php };?>
1046 </div>
1047 </form>
1048 </div>
1049 <?php
1050 }
1051
1052 /**
1053 * Render Search Overlay.
1054 *
1055 * Render button widget text.
1056 *
1057 * @since 1.5.0
1058 * @access protected
1059 */
1060 protected function render_category( $args ) {
1061 $taxonomies = $args['post_types'];
1062 $post_types = [];
1063 $options_output = '';
1064
1065 foreach( $taxonomies as $taxonomy ) {
1066
1067 $terms = get_terms( $taxonomy );
1068 $post_type = get_taxonomy( $taxonomy )->object_type;
1069 $post_types = array_merge( $post_types, $post_type );
1070
1071 foreach ($terms as $term => $term_args) {
1072 $options_output .= '<option data-post-type="' . esc_attr( wp_json_encode( $post_type ) ) . '" data-taxonomy="' . esc_attr( wp_json_encode( [$term_args->taxonomy] ) ) . '" value="'. esc_attr( $term_args->term_id ) .'">'. esc_html( $term_args->name ) .'</option>';
1073 }
1074
1075 }
1076
1077 $options_output = '<option value="all" data-taxonomy="' . esc_attr ( wp_json_encode( $taxonomies ) ) . '" data-post-type="' . esc_attr ( wp_json_encode( $post_types ) ) . '">' . __('All Categories', 'auxin-elements') . '</option>' . $options_output ;
1078
1079 echo '<div class="aux-search-cats">';
1080 echo '<select class="aux-modern-search-cats" name="cat">' . wp_kses_post( $options_output ) . '</select>';
1081 echo '</div>';
1082 }
1083
1084 /**
1085 * Get All Active Post Types.
1086 *
1087 * @since 1.5.0
1088 * @access protected
1089 */
1090 protected function get_post_types() {
1091 return auxin_get_available_post_types_for_search();
1092 }
1093
1094 /**
1095 * Render Modern Search widget output on the frontend.
1096 *
1097 * Written in PHP and used to generate the final HTML.
1098 *
1099 * @since 1.0.0
1100 * @access protected
1101 */
1102 protected function render() {
1103 $settings = $this->get_settings_for_display();
1104
1105 echo '<div class="aux-modern-search">';
1106
1107 $this->render_search_button([
1108 'submit_text' => $settings['text'],
1109 'icon' => $settings['icon']
1110 ]);
1111
1112 $this->render_search_overlay([
1113 'use_ajax' => auxin_is_true( $settings['use_ajax'] ),
1114 'display_submit' => auxin_is_true( $settings['fullscreen_display_submit'] ),
1115 'display_cats' => auxin_is_true( $settings['fullscreen_display_cats']),
1116 'display_fill' => auxin_is_true( $settings['fullscreen_display_fill_submit'] ),
1117 'post_types' => $settings['post_types'],
1118 'placeholder_text' => $settings['search_field_placeholder_text'],
1119 'search_title' => $settings['search_field_title']
1120 ]);
1121
1122 echo '</div>';
1123 }
1124
1125 }