PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.21
Shortcodes and extra features for Phlox theme v2.17.21
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 / mailchimp.php
auxin-elements / includes / elementor / widgets Last commit date
theme-elements 6 months ago accordion.php 6 months ago audio.php 6 months ago before-after.php 6 months ago button.php 6 months ago carousel-navigation.php 6 months ago circle-chart.php 6 months ago contact-box.php 6 months ago contact-form.php 6 months ago custom-list.php 6 months ago divider.php 6 months ago gallery.php 6 months ago gmap.php 3 days ago heading-modern.php 5 months ago icon.php 6 months ago image.php 6 months ago mailchimp.php 6 months ago modern-button.php 6 months ago products-grid.php 6 months ago quote.php 6 months ago recent-comments.php 6 months ago recent-posts-grid-carousel.php 1 month ago recent-posts-land-style.php 6 months ago recent-posts-masonry.php 6 months ago recent-posts-tiles-carousel.php 6 months ago recent-posts-tiles.php 6 months ago recent-posts-timeline.php 6 months ago recent-products.php 6 months ago responsive-table.php 6 months ago search.php 6 months ago staff.php 6 months ago svg.php 6 months ago tabs.php 6 months ago testimonial.php 6 months ago text.php 6 months ago touch-slider.php 6 months ago video.php 6 months ago
mailchimp.php
819 lines
1 <?php
2 namespace Auxin\Plugin\CoreElements\Elementor\Elements;
3
4 use Elementor\Plugin;
5 use Elementor\Widget_Base;
6 use Elementor\Controls_Manager;
7 use Elementor\Group_Control_Typography;
8 use Elementor\Group_Control_Background;
9 use Elementor\Group_Control_Box_Shadow;
10 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
11 use Elementor\Group_Control_Border;
12
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 /**
19 * Elementor 'MailChimp' widget.
20 *
21 * Elementor widget that displays an 'MailChimp' with lightbox.
22 *
23 * @since 1.0.0
24 */
25 class MailChimp extends Widget_Base {
26
27 /**
28 * Get widget name.
29 *
30 * Retrieve 'MailChimp' 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_mailchimp';
39 }
40
41 /**
42 * Get widget title.
43 *
44 * Retrieve 'MailChimp' 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 __('MailChimp', '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 'MailChimp' 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-mailchimp auxin-badge';
72 }
73
74 /**
75 * Get forms list.
76 *
77 * Retrieve 'MailChimp' widget icon.
78 *
79 * @since 1.0.0
80 * @access public
81 *
82 * @return string Widget icon.
83 */
84 public function get_forms() {
85 $options = array( 0 => __('Select the form to show', 'auxin-elements' ) ) ;
86
87 if( ! function_exists('mc4wp_get_forms') ){
88 return $options;
89 }
90
91 $forms = mc4wp_get_forms();
92 foreach( $forms as $form ) {
93 $options[ $form->ID ] = $form->name;
94 }
95
96 return $options;
97 }
98
99 /**
100 * Get widget categories.
101 *
102 * Retrieve 'MailChimp' widget icon.
103 *
104 * @since 1.0.0
105 * @access public
106 *
107 * @return string Widget icon.
108 */
109 public function get_categories() {
110 return array( 'auxin-core' );
111 }
112
113 /**
114 * Register 'MailChimp' widget controls.
115 *
116 * Adds different input fields to allow the user to change and customize the widget settings.
117 *
118 * @since 1.0.0
119 * @access protected
120 */
121 protected function register_controls() {
122
123 /*-----------------------------------------------------------------------------------*/
124 /* Content TAB
125 /*-----------------------------------------------------------------------------------*/
126
127 $this->start_controls_section(
128 'forms_section',
129 [
130 'label' => __('Form', 'auxin-elements' ),
131 ]
132 );
133
134 $this->add_control(
135 'form_type',
136 [
137 'label' => __( 'Form Type', 'auxin-elements' ),
138 'type' => Controls_Manager::SELECT,
139 'default' => 'default',
140 'options' => [
141 'default' => __( 'Defaults' , 'auxin-elements' ),
142 'custom' => __( 'Custom' , 'auxin-elements' )
143 ]
144 ]
145 );
146
147 $this->add_control(
148 'form_id',
149 [
150 'label' => __( 'MailChimp Sign-Up Form', 'auxin-elements' ),
151 'label_block' => true,
152 'type' => Controls_Manager::SELECT,
153 'default' => 0,
154 'options' => $this->get_forms(),
155 'condition' => [
156 'form_type' => ['default']
157 ]
158 ]
159 );
160
161 $this->add_control(
162 'html',
163 [
164 'label' => __( 'Custom Form', 'auxin-elements' ),
165 'type' => Controls_Manager::CODE,
166 'language' => 'html',
167 'description' => __( 'Enter your custom form markup', 'auxin-elements' ),
168 'condition' => [
169 'form_type' => ['custom']
170 ]
171 ]
172 );
173
174 $this->end_controls_section();
175
176 /*-----------------------------------------------------------------------------------*/
177 /* Style TAB
178 /*-----------------------------------------------------------------------------------*/
179
180 $this->start_controls_section(
181 'text_input_section',
182 [
183 'label' => __('Input', 'auxin-elements' ),
184 'tab' => Controls_Manager::TAB_STYLE,
185 ]
186 );
187
188 $this->add_group_control(
189 Group_Control_Typography::get_type(),
190 [
191 'name' => 'input_typography',
192 'label' => __( 'Typography', 'auxin-elements' ),
193 'global' => [
194 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
195 ],
196 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]',
197 ]
198 );
199
200 $this->add_control(
201 'input_color',
202 [
203 'label' => __( 'Color', 'auxin-elements' ),
204 'type' => Controls_Manager::COLOR,
205 'selectors' => [
206 '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'color: {{VALUE}};',
207 ]
208 ]
209 );
210
211 $this->add_responsive_control(
212 'text_input_width',
213 [
214 'label' => __( 'Width', 'auxin-elements' ),
215 'size_units' => [ 'px','em', '%'],
216 'type' => Controls_Manager::SLIDER,
217 'range' => [
218 'px' => [
219 'min' => 0,
220 'max' => 1000,
221 'step' => 5,
222 ],
223 '%' => [
224 'min' => 0,
225 'max' => 100,
226 ],
227 'em' => [
228 'min' => 0,
229 'max' => 100,
230 ],
231 ],
232 'selectors' => [
233 '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'width: {{SIZE}}{{UNIT}};',
234 ],
235 ]
236 );
237
238 $this->add_responsive_control(
239 'text_input_max_width',
240 [
241 'label' => __( 'Max Width', 'auxin-elements' ),
242 'size_units' => [ 'px','em', '%'],
243 'type' => Controls_Manager::SLIDER,
244 'range' => [
245 'px' => [
246 'min' => 0,
247 'max' => 1000,
248 'step' => 5
249 ],
250 '%' => [
251 'min' => 0,
252 'max' => 100
253 ],
254 'em' => [
255 'min' => 0,
256 'max' => 100
257 ]
258 ],
259 'selectors' => [
260 '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'max-width: {{SIZE}}{{UNIT}};',
261 ]
262 ]
263 );
264
265 $this->add_responsive_control(
266 'text_input_height',
267 [
268 'label' => __( 'Height', 'auxin-elements' ),
269 'size_units' => [ 'px', 'em'],
270 'type' => Controls_Manager::SLIDER,
271 'range' => [
272 'px' => [
273 'min' => 0,
274 'max' => 1000,
275 'step' => 5
276 ],
277 '%' => [
278 'min' => 0,
279 'max' => 100
280 ],
281 'em' => [
282 'min' => 0,
283 'max' => 100
284 ]
285 ],
286 'selectors' => [
287 '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'height: {{SIZE}}{{UNIT}};',
288 ],
289 'separator' => 'after'
290 ]
291 );
292
293
294 $this->add_group_control(
295 Group_Control_Border::get_type(),
296 [
297 'name' => 'input_border',
298 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]'
299 ]
300 );
301
302 $this->add_responsive_control(
303 'input_border_radius',
304 [
305 'label' => __( 'Border Radius', 'auxin-elements' ),
306 'type' => Controls_Manager::DIMENSIONS,
307 'size_units' => [ 'px', '%' ],
308 'selectors' => [
309 '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
310 ],
311 ]
312 );
313
314 $this->add_responsive_control(
315 'input_padding',
316 [
317 'label' => __( 'Padding', 'auxin-elements' ),
318 'type' => Controls_Manager::DIMENSIONS,
319 'size_units' => [ 'px', '%', 'em' ],
320 'selectors' => [
321 '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
322 ],
323 'separator' => 'after'
324 ]
325 );
326
327 // Background and Box Shadow for input - START
328 $this->start_controls_tabs( 'input_tabs' );
329
330 $this->start_controls_tab(
331 'input_tab_normal_state',
332 [
333 'label' => __( 'Normal', 'auxin-elements' ),
334 ]
335 );
336
337 $this->add_group_control(
338 Group_Control_Background::get_type(),
339 [
340 'name' => 'input_background',
341 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"], {{WRAPPER}} .mc4wp-form input[type="email"]',
342 'types' => [ 'classic', 'gradient']
343 ]
344 );
345
346 $this->add_group_control(
347 Group_Control_Box_Shadow::get_type(),
348 [
349 'name' => 'input_box_shadow',
350 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"], {{WRAPPER}} .mc4wp-form input[type="email"]'
351 ]
352 );
353
354 $this->end_controls_tab();
355
356 $this->start_controls_tab(
357 'input_tab_hover_state',
358 [
359 'label' => __( 'Hover', 'auxin-elements' ),
360 ]
361 );
362
363 $this->add_group_control(
364 Group_Control_Background::get_type(),
365 [
366 'name' => 'input_background_hover',
367 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"]:hover, {{WRAPPER}} .mc4wp-form input[type="email"]:hover',
368 'types' => [ 'classic', 'gradient']
369 ]
370 );
371
372 $this->add_group_control(
373 Group_Control_Box_Shadow::get_type(),
374 [
375 'name' => 'input_box_shadow_hover',
376 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"]:hover,{{WRAPPER}} .mc4wp-form input[type="email"]:hover'
377 ]
378 );
379
380 $this->add_control(
381 'input_transition',
382 [
383 'label' => __( 'Transition Duration', 'auxin-elements' ),
384 'type' => Controls_Manager::SLIDER,
385 'default' => [
386 'size' => 0.3,
387 ],
388 'range' => [
389 'px' => [
390 'max' => 3,
391 'step' => 0.1,
392 ],
393 ],
394 'render_type' => 'ui',
395 'selectors' => [
396 '{{WRAPPER}} .mc4wp-form input[type="text"],{{WRAPPER}} .mc4wp-form input[type="email"]' => "transition:all ease-out {{SIZE}}s;"
397 ]
398 ]
399 );
400
401 $this->end_controls_tab();
402
403 $this->end_controls_tabs();
404 // Background and Box Shadow for input - END
405
406
407 $this->end_controls_section();
408
409 $this->start_controls_section(
410 'placeholder_section',
411 [
412 'label' => __('Input Placeholder Text', 'auxin-elements' ),
413 'tab' => Controls_Manager::TAB_STYLE
414 ]
415 );
416
417 $this->add_group_control(
418 Group_Control_Typography::get_type(),
419 [
420 'name' => 'placeholder_typography',
421 'label' => __( 'Typography', 'auxin-elements' ),
422 'global' => [
423 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
424 ],
425 'selector' => '{{WRAPPER}} .mc4wp-form input[type="text"]::placeholder,{{WRAPPER}} .mc4wp-form input[type="email"]::placeholder'
426 ]
427 );
428
429 $this->add_control(
430 'placeholder_color',
431 [
432 'label' => __( 'Color', 'auxin-elements' ),
433 'type' => Controls_Manager::COLOR,
434 'selectors' => [
435 '{{WRAPPER}} .mc4wp-form input[type="text"]::placeholder,{{WRAPPER}} .mc4wp-form input[type="email"]::placeholder' => 'color: {{VALUE}};',
436 ]
437 ]
438 );
439
440 $this->end_controls_section();
441
442 $this->start_controls_section(
443 'submit_input_section',
444 [
445 'label' => __('Subscribe Button', 'auxin-elements' ),
446 'tab' => Controls_Manager::TAB_STYLE,
447 ]
448 );
449
450 $this->add_group_control(
451 Group_Control_Typography::get_type(),
452 [
453 'name' => 'submit_input_typography',
454 'label' => __( 'Typography', 'auxin-elements' ),
455 'global' => [
456 'default' => Global_Typography::TYPOGRAPHY_PRIMARY,
457 ],
458 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]',
459 ]
460 );
461
462 $this->add_responsive_control(
463 'submit_input_width',
464 [
465 'label' => __( 'Width', 'auxin-elements' ),
466 'size_units' => [ 'px','em', '%'],
467 'type' => Controls_Manager::SLIDER,
468 'range' => [
469 'px' => [
470 'min' => 0,
471 'max' => 1000,
472 'step' => 5,
473 ],
474 '%' => [
475 'min' => 0,
476 'max' => 100,
477 ],
478 'em' => [
479 'min' => 0,
480 'max' => 100,
481 ],
482 ],
483 'selectors' => [
484 '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'width: {{SIZE}}{{UNIT}};',
485 ],
486 ]
487 );
488
489 $this->add_responsive_control(
490 'submit_input_max_width',
491 [
492 'label' => __( 'Max Width', 'auxin-elements' ),
493 'size_units' => [ 'px','em', '%'],
494 'type' => Controls_Manager::SLIDER,
495 'range' => [
496 'px' => [
497 'min' => 0,
498 'max' => 1000,
499 'step' => 5,
500 ],
501 '%' => [
502 'min' => 0,
503 'max' => 100,
504 ],
505 'em' => [
506 'min' => 0,
507 'max' => 100,
508 ],
509 ],
510 'selectors' => [
511 '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'max-width: {{SIZE}}{{UNIT}};',
512 ],
513 ]
514 );
515
516 $this->add_responsive_control(
517 'submit_input_height',
518 [
519 'label' => __( 'Height', 'auxin-elements' ),
520 'size_units' => [ 'px', 'em'],
521 'type' => Controls_Manager::SLIDER,
522 'range' => [
523 'px' => [
524 'min' => 0,
525 'max' => 1000,
526 'step' => 5
527 ],
528 '%' => [
529 'min' => 0,
530 'max' => 100
531 ],
532 'em' => [
533 'min' => 0,
534 'max' => 100
535 ]
536 ],
537 'selectors' => [
538 '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'height: {{SIZE}}{{UNIT}};'
539 ],
540 'separator' => 'after'
541 ]
542 );
543
544 $this->add_group_control(
545 Group_Control_Border::get_type(),
546 [
547 'name' => 'submit_border',
548 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]'
549 ]
550 );
551
552 $this->add_responsive_control(
553 'submit_border_radius',
554 [
555 'label' => __( 'Border Radius', 'auxin-elements' ),
556 'type' => Controls_Manager::DIMENSIONS,
557 'size_units' => [ 'px', '%' ],
558 'selectors' => [
559 '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'border-radius:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
560 ],
561 ]
562 );
563
564 $this->add_responsive_control(
565 'submit_input_padding',
566 [
567 'label' => __( 'Padding', 'auxin-elements' ),
568 'type' => Controls_Manager::DIMENSIONS,
569 'size_units' => [ 'px', '%', 'em' ],
570 'selectors' => [
571 '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'padding:{{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
572 ]
573 ]
574 );
575
576 // Background and box shadow Options for submit button - START
577 $this->start_controls_tabs( 'submit_tabs' );
578
579 $this->start_controls_tab(
580 'submit_input_tab_normal_state',
581 [
582 'label' => __( 'Normal', 'auxin-elements' ),
583 ]
584 );
585
586 $this->add_control(
587 'submit_input_color_normal',
588 [
589 'label' => __( 'Color', 'auxin-elements' ),
590 'type' => Controls_Manager::COLOR,
591 'selectors' => [
592 '{{WRAPPER}} .mc4wp-form input[type="submit"]' => 'color: {{VALUE}};',
593 ],
594 ]
595 );
596
597 $this->add_group_control(
598 Group_Control_Background::get_type(),
599 [
600 'name' => 'submit_input_background',
601 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]',
602 'types' => [ 'classic', 'gradient'],
603 ]
604 );
605
606 $this->add_group_control(
607 Group_Control_Box_Shadow::get_type(),
608 [
609 'name' => 'sbumit_input_box_shadow',
610 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]'
611 ]
612 );
613
614
615 $this->end_controls_tab();
616
617 $this->start_controls_tab(
618 'submit_input_tab_hover_state',
619 [
620 'label' => __( 'Hover', 'auxin-elements' ),
621 ]
622 );
623
624 $this->add_control(
625 'submit_input_color_hover',
626 [
627 'label' => __( 'Color', 'auxin-elements' ),
628 'type' => Controls_Manager::COLOR,
629 'selectors' => [
630 '{{WRAPPER}} .mc4wp-form input[type="submit"]:hover' => 'color: {{VALUE}};',
631 ],
632 ]
633 );
634
635 $this->add_group_control(
636 Group_Control_Background::get_type(),
637 [
638 'name' => 'submit_input_background_hover',
639 'types' => [ 'classic', 'gradient'],
640 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]:hover',
641 ]
642 );
643
644 $this->add_group_control(
645 Group_Control_Box_Shadow::get_type(),
646 [
647 'name' => 'sbumit_input_box_shadow_hover',
648 'selector' => '{{WRAPPER}} .mc4wp-form input[type="submit"]:hover'
649 ]
650 );
651
652 $this->add_control(
653 'submit_input_hover_transition',
654 [
655 'label' => __( 'Transition Duration', 'auxin-elements' ),
656 'type' => Controls_Manager::SLIDER,
657 'default' => [
658 'size' => 0.3,
659 ],
660 'range' => [
661 'px' => [
662 'max' => 3,
663 'step' => 0.1,
664 ],
665 ],
666 'render_type' => 'ui',
667 'selectors' => [
668 '{{WRAPPER}} .mc4wp-form input[type="submit"]' => "transition: all ease-out {{SIZE}}s;"
669 ]
670 ]
671 );
672
673 $this->end_controls_tab();
674
675 $this->end_controls_tabs();
676 // Background and box shadow Options for submit button - END
677
678
679 $this->end_controls_section();
680
681
682 $this->start_controls_section(
683 'form_container_section',
684 [
685 'label' => __('Form Container', 'auxin-elements' ),
686 'tab' => Controls_Manager::TAB_STYLE
687 ]
688 );
689
690 $this->add_responsive_control(
691 'form_container_width',
692 [
693 'label' => __( 'Width', 'auxin-elements' ),
694 'size_units' => [ 'px','em', '%'],
695 'type' => Controls_Manager::SLIDER,
696 'range' => [
697 'px' => [
698 'min' => 0,
699 'max' => 1000,
700 'step' => 5
701 ],
702 '%' => [
703 'min' => 0,
704 'max' => 100
705 ],
706 'em' => [
707 'min' => 0,
708 'max' => 100
709 ],
710 ],
711 'selectors' => [
712 '{{WRAPPER}} .mc4wp-form-fields' => 'width: {{SIZE}}{{UNIT}};'
713 ]
714 ]
715 );
716
717 $this->add_responsive_control(
718 'form_container_max_width',
719 [
720 'label' => __( 'Max Width', 'auxin-elements' ),
721 'size_units' => [ 'px','em', '%'],
722 'type' => Controls_Manager::SLIDER,
723 'range' => [
724 'px' => [
725 'min' => 0,
726 'max' => 1000,
727 'step' => 5
728 ],
729 '%' => [
730 'min' => 0,
731 'max' => 100
732 ],
733 'em' => [
734 'min' => 0,
735 'max' => 100
736 ],
737 ],
738 'selectors' => [
739 '{{WRAPPER}} .mc4wp-form-fields' => 'max-width: {{SIZE}}{{UNIT}};'
740 ]
741 ]
742 );
743
744 $this->add_responsive_control(
745 'form_container_height',
746 [
747 'label' => __( 'Height', 'auxin-elements' ),
748 'size_units' => [ 'px', 'em'],
749 'type' => Controls_Manager::SLIDER,
750 'range' => [
751 'px' => [
752 'min' => 0,
753 'max' => 1000,
754 'step' => 5
755 ],
756 '%' => [
757 'min' => 0,
758 'max' => 100
759 ],
760 'em' => [
761 'min' => 0,
762 'max' => 100
763 ]
764 ],
765 'selectors' => [
766 '{{WRAPPER}} .mc4wp-form-fields' => 'height: {{SIZE}}{{UNIT}};'
767 ]
768 ]
769 );
770
771 $this->end_controls_section();
772 }
773
774 /**
775 * Render mailchimp custom form markup
776 *
777 *
778 * @since 1.0.0
779 * @access protected
780 */
781 public function custom_form( $content ) {
782 $settings = $this->get_settings_for_display();
783
784 if( ! empty( $settings['html'] ) ) {
785 $content = $settings['html'];
786 }
787
788 return $content;
789 }
790
791 /**
792 * Render mailchimp widget output on the frontend.
793 *
794 * Written in PHP and used to generate the final HTML.
795 *
796 * @since 1.0.0
797 * @access protected
798 */
799 protected function render() {
800 // Check whether required resources are available
801 if( ! function_exists('mc4wp_show_form') ) {
802 auxin_elementor_plugin_missing_notice( array( 'plugin_name' => __( 'MailChimp', 'auxin-elements' ) ) );
803 return;
804 }
805
806 $settings = $this->get_settings_for_display();
807
808 if( $settings['form_type'] === 'custom' ) {
809 add_filter( 'mc4wp_form_content', array( $this, 'custom_form'), 10, 1 );
810 $settings['form_id'] = 0;
811 } elseif( get_post_type( $settings['form_id'] ) !== 'mc4wp-form' ){
812 $settings['form_id'] = 0;
813 }
814
815 return mc4wp_show_form( $settings['form_id'] );
816 }
817
818 }
819