PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.6.13
Shortcodes and extra features for Phlox theme v2.6.13
2.17.22 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 6 years ago copyright.php 6 years ago current-time.php 6 years ago logo.php 6 years ago menu.php 6 years ago modern-search.php 6 years ago search.php 6 years ago shopping-cart.php 6 years ago site-title.php 6 years ago
modern-search.php
1002 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\Scheme_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' => __( '', 'auxin-elements' ),
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' => [ 'category' ],
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->end_controls_section();
208
209 /* Icon Style Section
210 /*-------------------------------------*/
211
212 $this->start_controls_section(
213 'icon_style_section',
214 [
215 'label' => __( 'Icon', 'auxin-elements' ),
216 'tab' => Controls_Manager::TAB_STYLE
217 ]
218 );
219
220 $this->start_controls_tabs( 'icon_styles' );
221
222 $this->start_controls_tab(
223 'icon_style_normal',
224 [
225 'label' => __( 'Normal' , 'auxin-elements' )
226 ]
227 );
228
229 $this->add_control(
230 'icon_color_normal',
231 [
232 'label' => __( 'Color', 'auxin-elements' ),
233 'type' => Controls_Manager::COLOR,
234 'selectors' => [
235 '{{WRAPPER}} .aux-search-submit i' => 'color: {{VALUE}};'
236 ]
237 ]
238 );
239
240 $this->add_responsive_control(
241 'icon_size_normal',
242 [
243 'label' => __( 'Size', 'auxin-elements' ),
244 'type' => Controls_Manager::SLIDER,
245 'size_units' => [ 'px', '%' ],
246 'range' => [
247 'px' => [
248 'min' => 16,
249 'max' => 512,
250 'step' => 2,
251 ],
252 '%' => [
253 'min' => 0,
254 'max' => 100,
255 ],
256 ],
257 'default' => [
258 'size' => 22,
259 'unit' => 'px'
260 ],
261 'selectors' => [
262 '{{WRAPPER}} .aux-search-submit i' => 'font-size: {{SIZE}}{{UNIT}};',
263 ],
264 ]
265 );
266
267 $this->end_controls_tab();
268
269 $this->start_controls_tab(
270 'icon_style_hover',
271 [
272 'label' => __( 'Hover' , 'auxin-elements' )
273 ]
274 );
275
276 $this->add_control(
277 'icon_color_hover',
278 [
279 'label' => __( 'Color', 'auxin-elements' ),
280 'type' => Controls_Manager::COLOR,
281 'selectors' => [
282 '{{WRAPPER}} .aux-search-submit:hover i' => 'color: {{VALUE}};'
283 ]
284 ]
285 );
286
287 $this->add_responsive_control(
288 'icon_size_hover',
289 [
290 'label' => __( 'Size', 'auxin-elements' ),
291 'type' => Controls_Manager::SLIDER,
292 'size_units' => [ 'px', '%' ],
293 'range' => [
294 'px' => [
295 'min' => 16,
296 'max' => 512,
297 'step' => 2,
298 ],
299 '%' => [
300 'min' => 0,
301 'max' => 100,
302 ],
303 ],
304 'selectors' => [
305 '{{WRAPPER}} .aux-search-submit:hover i' => 'font-size: {{SIZE}}{{UNIT}};',
306 ],
307 ]
308 );
309
310 $this->end_controls_tab();
311
312 $this->end_controls_tabs();
313
314 $this->end_controls_section();
315
316 /* Text Style Section
317 /*-------------------------------------*/
318 $this->start_controls_section(
319 'text_style_section',
320 [
321 'label' => __( 'Text', 'auxin-elements' ),
322 'tab' => Controls_Manager::TAB_STYLE,
323 'condition' => ['text!' => '']
324 ]
325 );
326
327 $this->start_controls_tabs( 'text_styles' );
328
329 $this->start_controls_tab(
330 'text_style_normal',
331 [
332 'label' => __( 'Normal' , 'auxin-elements' )
333 ]
334 );
335
336 $this->add_control(
337 'text_color_normal',
338 [
339 'label' => __( 'Color', 'auxin-elements' ),
340 'type' => Controls_Manager::COLOR,
341 'selectors' => [
342 '{{WRAPPER}} .aux-search-submit' => 'color: {{VALUE}};'
343 ]
344 ]
345 );
346
347 $this->add_group_control(
348 Group_Control_Typography::get_type(),
349 [
350 'name' => 'text_typo_normal',
351 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
352 'selector' => '{{WRAPPER}} .aux-search-submit'
353 ]
354 );
355
356 $this->add_group_control(
357 Group_Control_Text_Shadow::get_type(),
358 [
359 'name' => 'text_text_shadow_normal',
360 'selector' => '{{WRAPPER}} .aux-search-submit'
361 ]
362 );
363
364 $this->end_controls_tab();
365
366 $this->start_controls_tab(
367 'text_style_hover',
368 [
369 'label' => __( 'Hover' , 'auxin-elements' )
370 ]
371 );
372
373 $this->add_control(
374 'text_color_hover',
375 [
376 'label' => __( 'Color', 'auxin-elements' ),
377 'type' => Controls_Manager::COLOR,
378 'selectors' => [
379 '{{WRAPPER}} .aux-search-submit:hover' => 'color: {{VALUE}};'
380 ]
381 ]
382 );
383
384 $this->add_group_control(
385 Group_Control_Typography::get_type(),
386 [
387 'name' => 'text_typo_hover',
388 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
389 'selector' => '{{WRAPPER}} .aux-search-submit:hover'
390 ]
391 );
392
393 $this->add_group_control(
394 Group_Control_Text_Shadow::get_type(),
395 [
396 'name' => 'text_text_shadow_hover',
397 'selector' => '{{WRAPPER}} .aux-search-submit:hover'
398 ]
399 );
400
401 $this->end_controls_tab();
402
403 $this->end_controls_tabs();
404
405 $this->end_controls_section();
406
407 /* Button Style Section
408 /*-------------------------------------*/
409
410 $this->start_controls_section(
411 'button_style_section',
412 [
413 'label' => __( 'Button', 'auxin-elements' ),
414 'tab' => Controls_Manager::TAB_STYLE,
415 ]
416 );
417
418 $this->start_controls_tabs( 'button_styles' );
419
420 $this->start_controls_tab(
421 'button_style_normal',
422 [
423 'label' => __( 'Normal' , 'auxin-elements' )
424 ]
425 );
426
427 $this->add_group_control(
428 Group_Control_Background::get_type(),
429 [
430 'name' => 'button_bg_normal',
431 'selector' => '{{WRAPPER}} .aux-search-submit',
432 'types' => [ 'classic', 'gradient'],
433 'separator' => 'after'
434 ]
435 );
436
437 $this->add_responsive_control(
438 'button_padding_normal',
439 [
440 'label' => __( 'Padding', 'auxin-elements' ),
441 'type' => Controls_Manager::DIMENSIONS,
442 'size_units' => [ 'px', '%' ],
443 'selectors' => [
444 '{{WRAPPER}} .aux-search-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
445 ],
446 'separator' => 'before'
447 ]
448 );
449
450 $this->add_group_control(
451 Group_Control_Border::get_type(),
452 [
453 'name' => 'button_border_normal',
454 'selector' => '{{WRAPPER}} .aux-search-submit',
455 'separator' => 'none',
456 'separator' => 'before'
457 ]
458 );
459
460 $this->add_responsive_control(
461 'button_border_radius_normal',
462 [
463 'label' => __( 'Border Radius', 'auxin-elements' ),
464 'type' => Controls_Manager::DIMENSIONS,
465 'size_units' => [ 'px', 'em', '%' ],
466 'allowed_dimensions' => 'all',
467 'separator' => 'before',
468 'selectors' => [
469 '{{WRAPPER}} .aux-search-submit' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
470 ],
471 ]
472 );
473
474 $this->add_group_control(
475 Group_Control_Box_Shadow::get_type(),
476 [
477 'name' => 'button_box_shadow_normal',
478 'selector' => '{{WRAPPER}} .aux-search-submit',
479 'separator' => 'before'
480 ]
481 );
482
483 $this->end_controls_tab();
484
485 $this->start_controls_tab(
486 'button_style_hover',
487 [
488 'label' => __( 'Hover' , 'auxin-elements' )
489 ]
490 );
491
492 $this->add_group_control(
493 Group_Control_Background::get_type(),
494 [
495 'name' => 'button_bg_hover',
496 'selector' => '{{WRAPPER}} .aux-search-submit: hover',
497 'types' => [ 'classic', 'gradient'],
498 'separator' => 'after'
499 ]
500 );
501
502 $this->add_responsive_control(
503 'button_padding_hover',
504 [
505 'label' => __( 'Padding', 'auxin-elements' ),
506 'type' => Controls_Manager::DIMENSIONS,
507 'size_units' => [ 'px', '%' ],
508 'selectors' => [
509 '{{WRAPPER}} .aux-search-submit:hover' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
510 ],
511 'separator' => 'before'
512 ]
513 );
514
515 $this->add_group_control(
516 Group_Control_Border::get_type(),
517 [
518 'name' => 'button_border_hover',
519 'selector' => '{{WRAPPER}} .aux-search-submit:hover',
520 'separator' => 'before'
521 ]
522 );
523
524 $this->add_responsive_control(
525 'button_border_radius_hover',
526 [
527 'label' => __( 'Border Radius', 'auxin-elements' ),
528 'type' => Controls_Manager::DIMENSIONS,
529 'size_units' => [ 'px', 'em', '%' ],
530 'selectors' => [
531 '{{WRAPPER}} .aux-search-submit:hover' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
532 ],
533 'allowed_dimensions' => 'all',
534 'separator' => 'before'
535 ]
536 );
537 $this->add_group_control(
538 Group_Control_Box_Shadow::get_type(),
539 [
540 'name' => 'button_box_shadow_hover',
541 'selector' => '{{WRAPPER}} .aux-search-submit:hover',
542 'separator' => 'before'
543 ]
544 );
545
546 $this->end_controls_tab();
547
548 $this->end_controls_tabs();
549
550 $this->add_control(
551 'button_cursor',
552 [
553 'label' => __( 'Cursor', 'auxin-elements' ),
554 'type' => Controls_Manager::SELECT,
555 'options' => [
556 'default' => __( 'Default', 'auxin-elements' ),
557 'pointer' => __( 'Pointer', 'auxin-elements' ),
558 'zoom-in' => __( 'Zoom', 'auxin-elements' ),
559 'help' => __( 'Help', 'auxin-elements' )
560 ],
561 'default' => 'pointer',
562 'selectors' => [
563 '{{WRAPPER}} .aux-search-submit' => 'cursor: {{VALUE}};'
564 ],
565 'separator' => 'before'
566 ]
567 );
568
569 $this->end_controls_section();
570
571 /* Input Style Section
572 /*-------------------------------------*/
573
574 $this->start_controls_section(
575 'input_style_section',
576 [
577 'label' => __( 'Fullscreen Search Input', 'auxin-elements' ),
578 'tab' => Controls_Manager::TAB_STYLE
579 ]
580 );
581
582
583 $this->add_control(
584 'input_color',
585 [
586 'label' => __( 'Text Color', 'auxin-elements' ),
587 'type' => Controls_Manager::COLOR,
588 'selectors' => [
589 '{{WRAPPER}} .aux-search-popup .aux-search-field' => 'color: {{VALUE}};'
590 ],
591 'separator' => 'after'
592 ]
593 );
594
595 $this->add_group_control(
596 Group_Control_Typography::get_type(),
597 [
598 'name' => 'input_typo',
599 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
600 'selector' => '{{WRAPPER}} .aux-search-popup .aux-search-field',
601 'separator' => 'before'
602 ]
603 );
604
605 $this->add_responsive_control(
606 'input_padding',
607 [
608 'label' => __( 'Padding', 'auxin-elements' ),
609 'type' => Controls_Manager::DIMENSIONS,
610 'size_units' => [ 'px', '%' ],
611 'selectors' => [
612 '{{WRAPPER}} .aux-search-popup .aux-search-field' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
613 ],
614 'separator' => 'before'
615 ]
616 );
617
618 $this->add_responsive_control(
619 'input_border_size',
620 [
621 'label' => __( 'Border Size', 'auxin-elements' ),
622 'type' => Controls_Manager::SLIDER,
623 'size_units' => [ 'px' ],
624 'range' => [
625 'px' => [
626 'min' => 0,
627 'max' => 20,
628 'step' => 1,
629 ],
630 ],
631 'default' => [
632 'size' => 2,
633 'unit' => 'px'
634 ],
635 'selectors' => [
636 '{{WRAPPER}} .aux-search-popup .aux-search-input-form' => 'border-width: {{SIZE}}{{UNIT}};',
637 ],
638 'separator' => 'before'
639 ]
640 );
641
642 $this->add_control(
643 'input_border_color',
644 [
645 'label' => __( 'Border Color', 'auxin-elements' ),
646 'type' => Controls_Manager::COLOR,
647 'selectors' => [
648 '{{WRAPPER}} .aux-search-popup .aux-search-input-form' => 'border-color: {{VALUE}};'
649 ],
650 'separator' => 'before'
651 ]
652 );
653
654 $this->add_responsive_control(
655 'input_icon_size',
656 [
657 'label' => __( 'Icon Size', 'auxin-elements' ),
658 'type' => Controls_Manager::SLIDER,
659 'size_units' => [ 'px', '%' ],
660 'range' => [
661 'px' => [
662 'min' => 16,
663 'max' => 512,
664 'step' => 2,
665 ],
666 '%' => [
667 'min' => 0,
668 'max' => 100,
669 ],
670 ],
671 'default' => [
672 'size' => 30,
673 'unit' => 'px'
674 ],
675 'selectors' => [
676 '{{WRAPPER}} .aux-search-popup .aux-submit-icon-container:before' => 'font-size: {{SIZE}}{{UNIT}};',
677 ],
678 'separator' => 'before'
679 ]
680 );
681
682 $this->add_control(
683 'input_icon_color',
684 [
685 'label' => __( 'Icon Color', 'auxin-elements' ),
686 'type' => Controls_Manager::COLOR,
687 'selectors' => [
688 '{{WRAPPER}} .aux-search-popup .aux-submit-icon-container:before' => 'color: {{VALUE}} !important;'
689 ],
690 'separator' => 'before'
691 ]
692 );
693
694 $this->add_group_control(
695 Group_Control_Background::get_type(),
696 [
697 'name' => 'input_bg',
698 'selector' => '{{WRAPPER}} .aux-search-popup',
699 'types' => [ 'classic', 'gradient'],
700 'separator' => 'before',
701 'fields_options' => [
702 'background' => [
703 'label' => __( 'Overlay Color', 'auxin-elements' ),
704 ],
705 ],
706 ]
707 );
708
709 $this->end_controls_section();
710
711 /* Input Style Section
712 /*-------------------------------------*/
713
714 $this->start_controls_section(
715 'close_style_section',
716 [
717 'label' => __( 'Fullscreen Close Button', 'auxin-elements' ),
718 'tab' => Controls_Manager::TAB_STYLE
719 ]
720 );
721
722 $this->add_responsive_control(
723 'close_position_top',
724 [
725 'label' => __('Top Position','auxin-elements' ),
726 'type' => Controls_Manager::SLIDER,
727 'size_units' => ['px', 'em', '%'],
728 'range' => [
729 'px' => [
730 'min' => -2000,
731 'max' => 2000,
732 'step' => 1
733 ],
734 '%' => [
735 'min' => -100,
736 'max' => 100,
737 'step' => 1
738 ],
739 'em' => [
740 'min' => -150,
741 'max' => 150,
742 'step' => 1
743 ]
744 ],
745 'selectors' => [
746 '{{WRAPPER}} .aux-search-popup .aux-panel-close' => 'top:{{SIZE}}{{UNIT}};'
747 ],
748 ]
749 );
750
751 $this->add_responsive_control(
752 'close_position_right',
753 [
754 'label' => __('Right Position','auxin-elements' ),
755 'type' => Controls_Manager::SLIDER,
756 'size_units' => ['px', 'em', '%'],
757 'range' => [
758 'px' => [
759 'min' => -2000,
760 'max' => 2000,
761 'step' => 1
762 ],
763 '%' => [
764 'min' => -100,
765 'max' => 100,
766 'step' => 1
767 ],
768 'em' => [
769 'min' => -150,
770 'max' => 150,
771 'step' => 1
772 ]
773 ],
774 'selectors' => [
775 '{{WRAPPER}} .aux-search-popup .aux-panel-close' => 'right:{{SIZE}}{{UNIT}};'
776 ],
777 ]
778 );
779
780 $this->end_controls_section();
781 }
782
783 /**
784 * Render Search Input.
785 *
786 * Render button widget text.
787 *
788 * @since 1.5.0
789 * @access protected
790 */
791 protected function render_search_button( $args = [] ) { ;
792
793 $defaults = [
794 'submit_class' => 'aux-search-submit aux-search-fullscreen',
795 'submit_text' => '',
796 'wrapper_class' => 'aux-modern-search-wrapper',
797 'icon' => 'auxicon-search-4',
798 'target' => '.aux-search-popup-' . $this->get_id(),
799 'use_ajax' => false
800 ];
801
802 $args = wp_parse_args( $args, $defaults );
803
804 $this->add_render_attribute( 'wrapper', 'class', $args['wrapper_class'] );
805 $this->add_render_attribute( 'button', 'class', $args['submit_class'] );
806 $this->add_render_attribute( 'button', 'data-target', $args['target'] );
807 $this->add_render_attribute( 'submit_text', 'class', 'aux-submit-text' );
808 if ( empty( $args['icon']['library'] ) || $args['icon']['library'] != 'svg' ) {
809 $this->add_render_attribute( 'icon', 'class', $args['icon'] );
810 }
811 ?>
812 <div <?php echo $this->get_render_attribute_string( 'wrapper' );?> >
813 <button <?php echo $this->get_render_attribute_string( 'button' );?> >
814 <?php if ( empty( $args['icon']['library'] ) || $args['icon']['library'] != 'svg' ) { ?>
815 <i <?php echo $this->get_render_attribute_string( 'icon' );?>></i>
816 <?php } else { ?>
817 <img src="<?php echo esc_url( $args['icon']['value']['url'] ); ?>">
818 <?php } ?>
819 <span <?php echo $this->get_render_attribute_string( 'submit_text' );?> ><?php echo $args['submit_text']; ?></span>
820 </button>
821 </div>
822 <?php
823
824 }
825 /**
826 * Render Search Overlay.
827 *
828 * Render button widget text.
829 *
830 * @since 1.5.0
831 * @access protected
832 */
833 protected function render_search_overlay( $args = [] ) { ;
834
835 $defaults = [
836 'wrapper_class' => 'aux-search-popup aux-search-popup-' . $this->get_id(),
837 'use_ajax' => false,
838 'post_types' => []
839 ];
840
841 $args = wp_parse_args( $args, $defaults );
842
843 $form_args = [
844 'use_ajax' => $args['use_ajax'],
845 'display_submit' => $args['display_submit'],
846 'display_fill' => $args['display_fill'],
847 'display_cats' => $args['display_cats'],
848 'post_types' => $args['post_types']
849 ];
850
851 $this->add_render_attribute( 'overlay_wrapper', 'class', $args['wrapper_class'] );
852 ?>
853 <div <?php echo $this->get_render_attribute_string( 'overlay_wrapper' );?>>
854 <div class="aux-panel-close">
855 <div class="aux-close aux-cross-symbol aux-thick-medium"></div>
856 </div>
857 <div class="aux-search-popup-content">
858 <?php $this->render_search_form( $form_args ) ;?>
859 <?php if ( $args['use_ajax'] ) { ;?>
860 <div class="aux-search-ajax-container">
861 <div class="aux-search-ajax-output"></div>
862 <div class="aux-loading-spinner aux-spinner-hide">
863 <div class="aux-loading-loop">
864 <svg class="aux-circle" width="100%" height="100%" viewBox="0 0 42 42">
865 <circle class="aux-stroke-bg" r="20" cx="21" cy="21" fill="none"></circle>
866 <circle class="aux-progress" r="20" cx="21" cy="21" fill="none" transform="rotate(-90 21 21)"></circle>
867 </svg>
868 </div>
869 </div>
870 </div>
871 <?php };?>
872 </div>
873 </div>
874 <?php
875 }
876
877 /**
878 * Render Search Overlay.
879 *
880 * Render button widget text.
881 *
882 * @since 1.5.0
883 * @access protected
884 */
885 protected function render_search_form( $args = [] ) { ;
886
887 $defaults = [
888 'wrapper_class' => 'aux-search-form',
889 'use_ajax' => false,
890 'display_submit' => true,
891 'display_fill' => false,
892 'display_cats' => false,
893 'post_types' => []
894 ];
895
896 $args = wp_parse_args( $args, $defaults );
897
898 $this->add_render_attribute( 'form_wrapper', 'class', $args['wrapper_class'] );
899
900 if ( $args['use_ajax'] ) {
901 $this->add_render_attribute( 'form_wrapper', 'class', 'aux-search-ajax' );
902 }
903
904 ?>
905 <div <?php echo $this->get_render_attribute_string( 'form_wrapper' );?>>
906 <form action="<?php echo esc_url( home_url( '/' ) ); ?>" method="get" >
907 <div class="aux-search-input-form">
908 <input type="text" class="aux-search-field" placeholder="<?php esc_attr_e('Search...', 'auxin-elements' ); ?>" name="s" autocomplete="off" data-post-types="<?php echo esc_attr ( wp_json_encode( $args['post_types'] ) ) ;?>" />
909 <input type="hidden" name='post_type' value="<?php echo implode( ',', $args['post_types'] );?>">
910 <?php if ( $args['display_cats'] ) { ;?>
911 <?php $this->render_category( ['post_types' => $args['post_types'] ] );?>
912 <?php };?>
913 <?php if ( $args['display_submit'] ) { ;?>
914 <?php if ( $args['display_fill'] ) { ;?>
915 <input type="submit" class="aux-fill-search-submit" value="<?php esc_attr_e( 'Search', THEME_DOMAIN ); ?> " >
916 <?php } else { ;?>
917 <div class="aux-submit-icon-container auxicon-search-4">
918 <input type="submit" class="aux-iconic-search-submit" value="<?php esc_attr_e( 'Search', 'auxin-elements' ); ?>" >
919 </div>
920 <?php };?>
921 <?php };?>
922 </div>
923 </form>
924 </div>
925 <?php
926 }
927
928 /**
929 * Render Search Overlay.
930 *
931 * Render button widget text.
932 *
933 * @since 1.5.0
934 * @access protected
935 */
936 protected function render_category( $args ) {
937 $taxonomies = $args['post_types'];
938 $post_types = [];
939 $options_output = '';
940
941 foreach ( $taxonomies as $taxonomy ) {
942
943 $terms = get_terms( $taxonomy );
944 $post_type = get_taxonomy( $taxonomy )->object_type;
945 $post_types = array_merge( $post_types, $post_type );
946
947 foreach ($terms as $term => $term_args) {
948 $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>';
949 }
950
951 }
952
953 $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', THEME_DOMAIN) . '</option>' . $options_output ;
954
955 $output = '<div class="aux-search-cats">';
956 $output .= '<select class="aux-modern-search-cats" name="cat">' . $options_output . '</select>';
957 $output .= '</div>';
958
959 echo $output;
960 }
961
962 /**
963 * Get All Active Post Types.
964 *
965 * @since 1.5.0
966 * @access protected
967 */
968 protected function get_post_types() {
969 return auxin_get_available_post_types_for_search();
970 }
971
972 /**
973 * Render Modern Search widget output on the frontend.
974 *
975 * Written in PHP and used to generate the final HTML.
976 *
977 * @since 1.0.0
978 * @access protected
979 */
980 protected function render() {
981 $settings = $this->get_settings_for_display();
982
983 echo '<div class="aux-modern-search">';
984
985 $this->render_search_button( [
986 'submit_text' => $settings['text'],
987 'icon' => $settings['icon']
988 ] );
989
990 $this->render_search_overlay( [
991 'use_ajax' => auxin_is_true( $settings['use_ajax'] ),
992 'display_submit' => auxin_is_true( $settings['fullscreen_display_submit'] ),
993 'display_cats' => auxin_is_true( $settings['fullscreen_display_cats']),
994 'display_fill' => auxin_is_true( $settings['fullscreen_display_fill_submit'] ),
995 'post_types' => $settings['post_types']
996 ]
997 );
998
999 echo '</div>';
1000 }
1001
1002 }