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