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