PluginProbe
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.1
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.1
4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 All 183 releases
elementskit-lite / widgets / mail-chimp / mail-chimp.php
mail-chimp.php
2,151 lines 68.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor;
3
4 use \Elementor\ElementsKit_Widget_Mail_Chimp_Handler as Handler;
5 use \ElementsKit_Lite\Modules\Controls\Controls_Manager as ElementsKit_Controls_Manager;
6
7 if ( ! defined( 'ABSPATH' ) ) exit;
8
9
10 class ElementsKit_Widget_Mail_Chimp extends Widget_Base {
11 use \ElementsKit_Lite\Widgets\Widget_Notice;
12
13
14 public $base;
15
16 public function get_script_depends() {
17 return ['ekit-mailchimp'];
18 }
19
20 public function get_style_depends() {
21 return ['ekit-mail-chimp'];
22 }
23
24 public function get_name() {
25 return Handler::get_name();
26 }
27
28 public function get_title() {
29 return Handler::get_title();
30 }
31
32 public function get_icon() {
33 return Handler::get_icon();
34 }
35
36 public function get_categories() {
37 return Handler::get_categories();
38 }
39
40 public function get_keywords() {
41 return Handler::get_keywords();
42 }
43
44 public function get_help_url() {
45 return 'https://wpmet.com/doc/mailchimp-3/';
46 }
47 protected function is_dynamic_content(): bool {
48 return false;
49 }
50
51 public function __get_lists() {
52 $options = ['' => 'Select List'];
53 $dataApi = Handler::get_data();
54 $token = isset($dataApi['token']) ? $dataApi['token'] : '';
55
56 $server = explode('-', $token);
57
58 if (!isset($server[1])) {
59 return $options;
60 }
61
62 $url = 'https://' . $server[1] . '.api.mailchimp.com/3.0/lists';
63
64 $response = wp_remote_get($url, [
65 'headers' => [
66 'Authorization' => 'apikey ' . $token,
67 'Content-Type' => 'application/json; charset=utf-8',
68 ],
69 ]);
70
71 if (is_array($response) && !is_wp_error($response)) {
72 $body = (array) json_decode($response['body']);
73 $listed = isset($body['lists']) ? $body['lists'] : [];
74 if (is_array($listed) && sizeof($listed) > 0) {
75 foreach ($listed as $v) {
76 $options[$v->id] = $v->name;
77 }
78 }
79 }
80 return $options;
81 }
82
83 protected function register_controls() {
84
85 //start content Mail form design
86 $this->start_controls_section(
87 'ekit_mail_chimp_section_form', [
88 'label' => esc_html__( 'Form ', 'elementskit-lite' ),
89 ]
90 );
91
92 $this->add_control(
93 'ekit_mail_chimp_select_check_api',
94 [
95 'raw' => '<strong>' . esc_html__( 'Please note!', 'elementskit-lite' ) . '</strong> ' . esc_html__( 'Please set API Key in ElementsKit_Lite Dashboard - User Data - MailChimp and Create Campaign..', 'elementskit-lite' ),
96 'type' => Controls_Manager::RAW_HTML,
97 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
98 'render_type' => 'ui',
99 'condition' => [
100 'ekit_mail_chimp_select_listed_id' => '',
101 ],
102 ]
103 );
104 $this->add_control(
105 'ekit_mail_chimp_select_listed_id',
106 [
107 'label' => esc_html__( 'Select List', 'elementskit-lite' ),
108 'type' => Controls_Manager::SELECT,
109 'default' => '',
110 'options' => $this->__get_lists(),
111 'description' => esc_html__('Create a campaign in mailchimp account <a href="https://mailchimp.com/help/create-a-regular-email-campaign/#Create_a_campaign" target="_blank"> Create Campaign</a>', 'elementskit-lite'),
112 ]
113 );
114
115 $this->add_control(
116 'ekit_mail_chimp_double_opt_in',
117 [
118 'label' => esc_html__( 'Double Opt-in', 'elementskit-lite' ),
119 'type' => Controls_Manager::SWITCHER,
120 'default' => 'no',
121 'description' => esc_html__('If you enable this feature , then you must need to enable it inside Mailchimp campaign settings. Otherwise please disable it.', 'elementskit-lite')
122 ]
123 );
124
125 $this->add_control(
126 'ekit_mail_chimp_opt_in_success_message',
127 [
128 'label' => esc_html__( 'Opt-in Success Message', 'elementskit-lite' ),
129 'type' => Controls_Manager::TEXT,
130 'dynamic' => [
131 'active' => true,
132 ],
133 'label_block' => true,
134 'default' => esc_html__( 'Please check your mail and confirm subscribe', 'elementskit-lite' ),
135 'placeholder' => esc_html__( 'Type your title here', 'elementskit-lite' ),
136 'condition' => [
137 'ekit_mail_chimp_double_opt_in' => 'yes',
138 ],
139 ]
140 );
141
142 $repeater = new Repeater();
143
144 $repeater->add_control(
145 'ekit_mail_chimp_field_type',
146 [
147 'label' => esc_html__( 'Type', 'elementskit-lite' ),
148 'type' => Controls_Manager::SELECT,
149 'default' => 'text',
150 'options' => [
151 'text' => esc_html__( 'Text', 'elementskit-lite' ),
152 'email' => esc_html__( 'Email', 'elementskit-lite' ),
153 'tel' => esc_html__( 'Phone', 'elementskit-lite' ),
154 'textarea' => esc_html__( 'Textarea', 'elementskit-lite' ),
155 ],
156 ]
157 );
158
159 $repeater->add_control(
160 'ekit_mail_chimp_field_label',
161 [
162 'label' => esc_html__( 'Label', 'elementskit-lite' ),
163 'type' => Controls_Manager::TEXT,
164 'default' => esc_html__( 'Label', 'elementskit-lite' ),
165 'dynamic' => [
166 'active' => true,
167 ],
168 ]
169 );
170
171 $repeater->add_control(
172 'ekit_mail_chimp_field_placeholder',
173 [
174 'label' => esc_html__( 'Placeholder', 'elementskit-lite' ),
175 'type' => Controls_Manager::TEXT,
176 'default' => esc_html__( 'Placeholder', 'elementskit-lite' ),
177 'dynamic' => [
178 'active' => true,
179 ],
180 ]
181 );
182
183 $repeater->add_control(
184 'ekit_mail_chimp_field_name',
185 [
186 'label' => esc_html__( 'Name', 'elementskit-lite' ),
187 'type' => Controls_Manager::TEXT,
188 'description' => esc_html__( 'This name must match with your MailChimp MERGE tag.', 'elementskit-lite' ),
189 'default' => '',
190 'dynamic' => [
191 'active' => true,
192 ],
193 ]
194 );
195
196 $repeater->add_control(
197 'ekit_mail_chimp_field_required',
198 [
199 'label' => esc_html__( 'Required', 'elementskit-lite' ),
200 'type' => Controls_Manager::SWITCHER,
201 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
202 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
203 'return_value' => 'yes',
204 'default' => 'no',
205 ]
206 );
207
208 $repeater->add_control(
209 'ekit_mail_chimp_field_icon_show',
210 [
211 'label' => esc_html__( 'Show Icon', 'elementskit-lite' ),
212 'type' => Controls_Manager::SWITCHER,
213 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
214 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
215 'return_value' => 'yes',
216 'default' => 'no',
217 ]
218 );
219
220 $repeater->add_control(
221 'ekit_mail_chimp_field_icon',
222 [
223 'label' => esc_html__( 'Icon', 'elementskit-lite' ),
224 'type' => Controls_Manager::ICONS,
225 'default' => [
226 'value' => 'fas fa-user',
227 'library' => 'fa-solid',
228 ],
229 'condition' => [
230 'ekit_mail_chimp_field_icon_show' => 'yes',
231 ],
232 ]
233 );
234
235 $repeater->add_control(
236 'ekit_mail_chimp_field_icon_position',
237 [
238 'label' => esc_html__( 'Icon Position', 'elementskit-lite' ),
239 'type' => Controls_Manager::SELECT,
240 'default' => 'before',
241 'options' => [
242 'before' => esc_html__( 'Before', 'elementskit-lite' ),
243 'after' => esc_html__( 'After', 'elementskit-lite' ),
244 ],
245 'condition' => [
246 'ekit_mail_chimp_field_icon_show' => 'yes',
247 ],
248 ]
249 );
250
251 $this->add_control(
252 'ekit_mail_chimp_fields_repeater',
253 [
254 'label' => esc_html__( 'Form Fields', 'elementskit-lite' ),
255 'type' => Controls_Manager::REPEATER,
256 'fields' => $repeater->get_controls(),
257 'default' => [
258 [
259 'ekit_mail_chimp_field_type' => 'email',
260 'ekit_mail_chimp_field_label' => 'Email Address',
261 'ekit_mail_chimp_field_placeholder' => 'Email Address',
262 'ekit_mail_chimp_field_name' => 'email',
263 'ekit_mail_chimp_field_required' => 'yes',
264 'ekit_mail_chimp_field_icon_show' => 'yes',
265 'ekit_mail_chimp_field_icon' => [
266 'value' => 'icon icon-envelope',
267 'library' => 'ekiticons',
268 ],
269 'ekit_mail_chimp_field_icon_position' => 'before',
270 ]
271 ],
272 'title_field' => '{{{ ekit_mail_chimp_field_label }}}',
273 ]
274 );
275
276 // submit button text
277 $this->add_control(
278 'ekit_mail_chimp_submit',
279 [
280 'label' => esc_html__( 'Submit Button Text', 'elementskit-lite' ),
281 'type' => Controls_Manager::TEXT,
282 'dynamic' => [
283 'active' => true,
284 ],
285 'default' => esc_html__( 'Sign Up', 'elementskit-lite' ),
286 'label_block' => false,
287 ]
288 );
289 $this->add_control(
290 'ekit_mail_chimp_submit_button_heading',
291 [
292 'label' => esc_html__( 'Submit Button:', 'elementskit-lite' ),
293 'type' => Controls_Manager::HEADING,
294 ]
295 );
296 $this->add_control(
297 'ekit_mail_chimp_submit_icon_show',
298 [
299 'label' => esc_html__( 'Show Icon', 'elementskit-lite' ),
300 'type' => Controls_Manager::SWITCHER,
301 'label_on' => esc_html__( 'Show', 'elementskit-lite' ),
302 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ),
303 'return_value' => 'yes',
304 'default' => 'yes',
305 ]
306 );
307 $this->add_control(
308 'ekit_mail_chimp_submit_icons',
309 [
310 'label' => esc_html__( 'Button Icons', 'elementskit-lite' ),
311 'type' => Controls_Manager::ICONS,
312 'fa4compatibility' => 'ekit_mail_chimp_submit_icon',
313 'default' => [
314 'value' => 'icon icon-tick',
315 'library' => 'ekiticons',
316 ],
317 'condition' => [
318 'ekit_mail_chimp_submit_icon_show' => 'yes'
319 ]
320 ]
321 );
322 $this->add_control(
323 'ekit_mail_chimp_submit_icon_position',
324 [
325 'label' => esc_html__( 'Icon Position', 'elementskit-lite' ),
326 'type' => Controls_Manager::SELECT,
327 'default' => 'before',
328 'options' => [
329 'before' => esc_html__( 'Before', 'elementskit-lite' ),
330 'after' => esc_html__( 'After', 'elementskit-lite' ),
331 ],
332 'condition' => [
333 'ekit_mail_chimp_submit_icon_show' => 'yes',
334 'ekit_mail_chimp_submit_icons!' => ''
335 ]
336 ]
337 );
338
339 $this->add_control(
340 'ekit_mail_chimp_form_style_switcher',
341 [
342 'label' =>esc_html__( 'Form Style', 'elementskit-lite' ),
343 'type' => Controls_Manager::SELECT,
344 'default' => 'yes',
345 'options' => [
346 'yes' =>esc_html__( 'Inline', 'elementskit-lite' ),
347 'no' =>esc_html__( 'Full Width', 'elementskit-lite' ),
348 ],
349 ]
350 );
351
352 $this->add_control(
353 'ekit_mail_chimp_success_message',
354 [
355 'label' => __( 'Success Message', 'elementskit-lite' ),
356 'type' => Controls_Manager::TEXT,
357 'dynamic' => [
358 'active' => true,
359 ],
360 'default' => __( 'Successfully listed this email', 'elementskit-lite' ),
361 'placeholder' => __( 'Type your title here', 'elementskit-lite' ),
362 ]
363 );
364
365 $this->end_controls_section();
366 // end content form
367
368 // label
369 $this->start_controls_section(
370 'ekit_mail_chimp_input_label_style',
371 [
372 'label' => esc_html__( 'Label', 'elementskit-lite' ),
373 'tab' => Controls_Manager::TAB_STYLE,
374 ]
375 );
376
377 $this->add_group_control(
378 Group_Control_Typography::get_type(),
379 [
380 'name' => 'ekit_mail_chimp_input_label_typography',
381 'label' => esc_html__( 'Typography', 'elementskit-lite' ),
382 'selector' => '{{WRAPPER}} .elementskit_input_label',
383 ]
384 );
385
386 $this->add_responsive_control(
387 'ekit_mail_chimp_input_label_color',
388 [
389 'label' => esc_html__( 'Color', 'elementskit-lite' ),
390 'type' => Controls_Manager::COLOR,
391 'default' => '#000000',
392 'selectors' => [
393 '{{WRAPPER}} .elementskit_input_label' => 'color: {{VALUE}}',
394 ],
395 ]
396 );
397
398 $this->add_responsive_control(
399 'ekit_mail_chimp_input_label_margin',
400 [
401 'label' => esc_html__( 'Margin', 'elementskit-lite' ),
402 'type' => Controls_Manager::DIMENSIONS,
403 'size_units' => [ 'px', '%', 'em' ],
404 'selectors' => [
405 '{{WRAPPER}} .elementskit_input_label' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
406 ],
407 ]
408 );
409
410 $this->end_controls_section();
411
412
413 $this->start_controls_section(
414 'ekit_mail_chimp_input_wrapper_style',
415 [
416 'label' => esc_html__( 'Input Wrapper', 'elementskit-lite' ),
417 'tab' => Controls_Manager::TAB_STYLE,
418 ]
419 );
420 $this->add_responsive_control(
421 'ekit_mail_chimp_input_column_gap',
422 [
423 'label' => esc_html__( 'Column Gap', 'elementskit-lite' ),
424 'type' => Controls_Manager::SLIDER,
425 'size_units' => [ 'px', 'em' ],
426 'default' => [
427 'unit' => 'px',
428 'size' => 0,
429 ],
430 'selectors' => [
431 '{{WRAPPER}} .elementskit_inline_form' => '--input-gap: 0px;',
432 '{{WRAPPER}} .elementskit_inline_form' => '--input-gap: {{SIZE}}{{UNIT}};',
433 '{{WRAPPER}} .elementskit_form_wraper' => 'column-gap: {{SIZE}}{{UNIT}};',
434 ],
435 ]
436 );
437
438 $this->add_responsive_control(
439 'ekit_mail_chimp_input_row_gap',
440 [
441 'label' => esc_html__( 'Row Gap', 'elementskit-lite' ),
442 'type' => Controls_Manager::SLIDER,
443 'size_units' => [ 'px', 'em' ],
444 'default' => [
445 'unit' => 'px',
446 'size' => 0,
447 ],
448 'selectors' => [
449 '{{WRAPPER}} .elementskit_form_wraper' => 'row-gap: {{SIZE}}{{UNIT}};',
450 ],
451 ]
452 );
453 $this->add_responsive_control(
454 'ekit_mail_chimp_input_space_between',
455 [
456 'label' => esc_html__( 'Icon Gap', 'elementskit-lite' ),
457 'type' => Controls_Manager::SLIDER,
458 'size_units' => [ 'px', 'em' ],
459 'default' => [
460 'unit' => 'px',
461 'size' => 0,
462 ],
463 'selectors' => [
464 '{{WRAPPER}} .elementskit_input_element_container' => 'gap: {{SIZE}}{{UNIT}};',
465 ],
466 'separator' => 'after',
467 ]
468 );
469
470 // Input Wrapper Tabs
471 $this->start_controls_tabs(
472 'ekit_mail_chimp_input_wrapper_tabs'
473 );
474
475 // Normal Tab
476 $this->start_controls_tab(
477 'ekit_mail_chimp_input_wrapper_normal_tab',
478 [
479 'label' => esc_html__( 'Normal', 'elementskit-lite' ),
480 ]
481 );
482
483 $this->add_control(
484 'ekit_mail_chimp_input_wrapper_color',
485 [
486 'label' => esc_html__( 'Color', 'elementskit-lite' ),
487 'type' => Controls_Manager::COLOR,
488 'selectors' => [
489 '{{WRAPPER}} .elementskit_input_element_container .ekit_form_control' => 'color: {{VALUE}};',
490 ],
491 ]
492 );
493
494 $this->add_group_control(
495 Group_Control_Background::get_type(),
496 [
497 'name' => 'ekit_mail_chimp_input_wrapper_background',
498 'label' => esc_html__( 'Background', 'elementskit-lite' ),
499 'types' => [ 'classic', 'gradient' ],
500 'selector' => '{{WRAPPER}} .elementskit_input_element_container',
501 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
502 ]
503 );
504
505 $this->add_group_control(
506 Group_Control_Border::get_type(),
507 [
508 'name' => 'ekit_mail_chimp_input_wrapper_border',
509 'label' => esc_html__( 'Border', 'elementskit-lite' ),
510 'selector' => '{{WRAPPER}} .elementskit_input_element_container',
511 ]
512 );
513
514 $this->add_group_control(
515 Group_Control_Box_Shadow::get_type(),
516 [
517 'name' => 'ekit_mail_chimp_input_wrapper_box_shadow',
518 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
519 'selector' => '{{WRAPPER}} .elementskit_input_element_container',
520 ]
521 );
522
523 $this->end_controls_tab();
524
525 // Hover Tab
526 $this->start_controls_tab(
527 'ekit_mail_chimp_input_wrapper_hover_tab',
528 [
529 'label' => esc_html__( 'Hover', 'elementskit-lite' ),
530 ]
531 );
532
533 $this->add_control(
534 'ekit_mail_chimp_input_wrapper_hover_color',
535 [
536 'label' => esc_html__( 'Color', 'elementskit-lite' ),
537 'type' => Controls_Manager::COLOR,
538 'selectors' => [
539 '{{WRAPPER}} .elementskit_input_element_container:has(.ekit_form_control:hover) .ekit_form_control' => 'color: {{VALUE}};',
540 ],
541 ]
542 );
543
544 $this->add_group_control(
545 Group_Control_Background::get_type(),
546 [
547 'name' => 'ekit_mail_chimp_input_wrapper_hover_background',
548 'label' => esc_html__( 'Background', 'elementskit-lite' ),
549 'types' => [ 'classic', 'gradient' ],
550 'selector' => '{{WRAPPER}} .elementskit_input_element_container:hover',
551 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
552 ]
553 );
554
555 $this->add_group_control(
556 Group_Control_Border::get_type(),
557 [
558 'name' => 'ekit_mail_chimp_input_wrapper_hover_border',
559 'label' => esc_html__( 'Border', 'elementskit-lite' ),
560 'selector' => '{{WRAPPER}} .elementskit_input_element_container:hover',
561 ]
562 );
563
564 $this->add_group_control(
565 Group_Control_Box_Shadow::get_type(),
566 [
567 'name' => 'ekit_mail_chimp_input_wrapper_hover_box_shadow',
568 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
569 'selector' => '{{WRAPPER}} .elementskit_input_element_container:hover',
570 ]
571 );
572
573 $this->end_controls_tab();
574
575 // Focus Tab
576 $this->start_controls_tab(
577 'ekit_mail_chimp_input_wrapper_focus_tab',
578 [
579 'label' => esc_html__( 'Focus', 'elementskit-lite' ),
580 ]
581 );
582
583 $this->add_control(
584 'ekit_mail_chimp_input_wrapper_focus_color',
585 [
586 'label' => esc_html__( 'Color', 'elementskit-lite' ),
587 'type' => Controls_Manager::COLOR,
588 'selectors' => [
589 '{{WRAPPER}} .elementskit_input_element_container:focus-within .ekit_form_control' => 'color: {{VALUE}};',
590 ],
591 ]
592 );
593
594 $this->add_group_control(
595 Group_Control_Background::get_type(),
596 [
597 'name' => 'ekit_mail_chimp_input_wrapper_focus_background',
598 'label' => esc_html__( 'Background', 'elementskit-lite' ),
599 'types' => [ 'classic', 'gradient' ],
600 'selector' => '{{WRAPPER}} .elementskit_input_element_container:focus-within',
601 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
602 ]
603 );
604
605 $this->add_group_control(
606 Group_Control_Border::get_type(),
607 [
608 'name' => 'ekit_mail_chimp_input_wrapper_focus_border',
609 'label' => esc_html__( 'Border', 'elementskit-lite' ),
610 'selector' => '{{WRAPPER}} .elementskit_input_element_container:focus-within',
611 ]
612 );
613
614 $this->add_group_control(
615 Group_Control_Box_Shadow::get_type(),
616 [
617 'name' => 'ekit_mail_chimp_input_wrapper_focus_box_shadow',
618 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
619 'selector' => '{{WRAPPER}} .elementskit_input_element_container:focus-within',
620 ]
621 );
622
623 $this->end_controls_tab();
624 $this->end_controls_tabs();
625
626 // Border Radius (outside tabs)
627 $this->add_responsive_control(
628 'ekit_mail_chimp_input_wrapper_border_radius',
629 [
630 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
631 'type' => Controls_Manager::DIMENSIONS,
632 'size_units' => [ 'px', '%' ],
633 'selectors' => [
634 '{{WRAPPER}} .elementskit_input_element_container' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
635 ],
636 'separator' => 'before',
637 ]
638 );
639
640 // Padding (outside tabs)
641 $this->add_responsive_control(
642 'ekit_mail_chimp_input_wrapper_padding',
643 [
644 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
645 'type' => Controls_Manager::DIMENSIONS,
646 'size_units' => [ 'px', '%', 'em' ],
647 'selectors' => [
648 '{{WRAPPER}} .elementskit_input_element_container .ekit_form_control' =>
649 'padding-top: {{TOP}}{{UNIT}}; padding-right: {{RIGHT}}{{UNIT}}; padding-bottom: {{BOTTOM}}{{UNIT}};',
650 '{{WRAPPER}} .elementskit_input_element_container .elementskit_input_group_prepend' =>
651 'padding-top: {{TOP}}{{UNIT}}; padding-left: {{LEFT}}{{UNIT}}; padding-bottom: {{BOTTOM}}{{UNIT}};',
652 ],
653 ]
654 );
655
656 $this->end_controls_section();
657 // input style
658 $this->start_controls_section(
659 'ekit_mail_chimp_input_style',
660 [
661 'label' => esc_html__( 'Input', 'elementskit-lite' ),
662 'tab' => Controls_Manager::TAB_STYLE,
663 ]
664 );
665
666
667
668
669 $this->add_control(
670 'ekit_mail_chimp_input_style_width__switch',
671 [
672 'label' => esc_html__( 'Use Width', 'elementskit-lite' ),
673 'type' => Controls_Manager::SWITCHER,
674 'label_on' => esc_html__( 'Show', 'elementskit-lite' ),
675 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ),
676 'separator' => 'before',
677 'return_value' => 'yes',
678 'default' => 'no',
679 ]
680 );
681
682 $this->add_responsive_control(
683 'ekit_mail_chimp_input_style_width',
684 [
685 'label' => esc_html__( 'Width', 'elementskit-lite' ),
686 'type' => Controls_Manager::SLIDER,
687 'size_units' => [ 'px', '%' ],
688 'default' => [
689 'unit' => '%',
690 'size' => 66
691 ],
692 'range' => [
693 'px' => [
694 'min' => 0,
695 'max' => 1000,
696 'step' => 5,
697 ],
698 '%' => [
699 'min' => 0,
700 'max' => 100,
701 ],
702 ],
703 'selectors' => [
704 '{{WRAPPER}} .elementskit_form_wraper .elementskit_input_container' => 'flex: 0 0 calc({{SIZE}}{{UNIT}} - var(--input-gap, 30px) / 2);',
705 ],
706 'condition' => [
707 'ekit_mail_chimp_input_style_width__switch' => 'yes'
708 ]
709 ]
710 );
711
712 $this->add_group_control(
713 Group_Control_Typography::get_type(),
714 [
715 'name' => 'ekit_mail_chimp_input_typography',
716 'label' => esc_html__( 'Typography', 'elementskit-lite' ),
717 'selector' => '{{WRAPPER}} .ekit_form_control',
718 ]
719 );
720
721 $this->start_controls_tabs(
722 'mailchimp_input_tabs'
723 );
724
725 $this->start_controls_tab(
726 'mailchimp_input_normal_tab',
727 [
728 'label' => esc_html__( 'Normal', 'elementskit-lite' ),
729 ]
730 );
731
732 $this->add_group_control(
733 Group_Control_Background::get_type(),
734 [
735 'name' => 'ekit_mail_chimp_input_style_background',
736 'label' => esc_html__( 'Background', 'elementskit-lite' ),
737 'types' => [ 'classic', 'gradient' ],
738 'selector' => '{{WRAPPER}} .ekit_form_control',
739 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
740 ]
741 );
742
743 $this->add_group_control(
744 Group_Control_Border::get_type(),
745 [
746 'name' => 'ekit_mail_chimp_input_style_border',
747 'label' => esc_html__( 'Border', 'elementskit-lite' ),
748 'selector' => '{{WRAPPER}} .ekit_form_control',
749 ]
750 );
751
752 $this->add_group_control(
753 Group_Control_Box_Shadow::get_type(),
754 [
755 'name' => 'ekit_mail_chimp_input_style_box_shadow',
756 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
757 'selector' => '{{WRAPPER}} .ekit_form_control, {{WRAPPER}} .ekit_form_control:focus',
758 ]
759 );
760
761 $this->end_controls_tab();
762
763 $this->start_controls_tab(
764 'mailchimp_input_hover_tab',
765 [
766 'label' => esc_html__( 'Hover', 'elementskit-lite' ),
767 ]
768 );
769
770 $this->add_group_control(
771 Group_Control_Background::get_type(),
772 [
773 'name' => 'ekit_mail_chimp_input_style_hover_background',
774 'label' => esc_html__( 'Background', 'elementskit-lite' ),
775 'types' => [ 'classic', 'gradient' ],
776 'selector' => '{{WRAPPER}} .ekit_form_control:hover',
777 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
778 ]
779 );
780
781 $this->add_group_control(
782 Group_Control_Border::get_type(),
783 [
784 'name' => 'ekit_mail_chimp_input_style_hover_border',
785 'label' => esc_html__( 'Border', 'elementskit-lite' ),
786 'selector' => '{{WRAPPER}} .ekit_form_control:hover',
787 ]
788 );
789
790 $this->add_group_control(
791 Group_Control_Box_Shadow::get_type(),
792 [
793 'name' => 'ekit_mail_chimp_input_style_hover_box_shadow',
794 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
795 'selector' => '{{WRAPPER}} .ekit_form_control:hover',
796 ]
797 );
798
799 $this->end_controls_tab();
800
801 $this->start_controls_tab(
802 'mailchimp_input_focus_tab',
803 [
804 'label' => esc_html__( 'Focus', 'elementskit-lite' ),
805 ]
806 );
807
808 $this->add_group_control(
809 Group_Control_Background::get_type(),
810 [
811 'name' => 'ekit_mail_chimp_input_focus_style_background',
812 'label' => esc_html__( 'Background', 'elementskit-lite' ),
813 'types' => [ 'classic', 'gradient' ],
814 'selector' => '{{WRAPPER}} .ekit_form_control:focus',
815 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
816 ]
817 );
818
819 $this->add_group_control(
820 Group_Control_Border::get_type(),
821 [
822 'name' => 'ekit_mail_chimp_input_focus_style_border',
823 'label' => esc_html__( 'Border', 'elementskit-lite' ),
824 'selector' => '{{WRAPPER}} .ekit_form_control:focus',
825 ]
826 );
827
828 $this->add_group_control(
829 Group_Control_Box_Shadow::get_type(),
830 [
831 'name' => 'ekit_mail_chimp_input_focus_style_box_shadow',
832 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
833 'selector' => '{{WRAPPER}} .ekit_form_control:focus',
834 ]
835 );
836
837 $this->end_controls_tab();
838 $this->end_controls_tabs();
839
840 $this->add_responsive_control(
841 'ekit_mail_chimp_input_style_radius',
842 [
843 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
844 'type' => Controls_Manager::DIMENSIONS,
845 'size_units' => [ 'px', '%' ],
846 'selectors' => [
847 '{{WRAPPER}} .ekit_form_control' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
848 ],
849 'separator' => 'before',
850 ]
851 );
852
853 $this->add_responsive_control(
854 'ekit_mail_chimp_input_style_padding',
855 [
856 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
857 'type' => Controls_Manager::DIMENSIONS,
858 'size_units' => [ 'px', '%', 'em' ],
859 'default' => [
860 'top' => 0,
861 'right' => 20,
862 'bottom' => 0,
863 'left' => 20
864 ],
865 'selectors' => [
866 '{{WRAPPER}} .ekit_form_control' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
867 ],
868 ]
869 );
870
871
872
873 $this->add_responsive_control(
874 'ekit_mail_chimp_input_style_margin_bottom',
875 [
876 'label' => esc_html__( 'Margin Bottom', 'elementskit-lite' ),
877 'type' => Controls_Manager::SLIDER,
878 'size_units' => [ 'px' ],
879 'range' => [
880 'px' => [
881 'min' => 0,
882 'max' => 100,
883 'step' => 1,
884 ],
885 ],
886 'default' => [
887 'unit' => 'px',
888 'size' => 20,
889 ],
890 'selectors' => [
891 '{{WRAPPER}} .elementskit_input_wraper:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
892 ],
893 'condition' => [
894 'ekit_mail_chimp_form_style_switcher!' => 'yes'
895 ]
896 ]
897 );
898
899 $this->add_responsive_control(
900 'ekit_mail_chimp_input_style_margin_right',
901 [
902 'label' => esc_html__( 'Margin Right', 'elementskit-lite' ),
903 'type' => Controls_Manager::SLIDER,
904 'size_units' => [ 'px', ],
905 'range' => [
906 'px' => [
907 'min' => 0,
908 'max' => 100,
909 'step' => 1,
910 ],
911 ],
912 'default' => [
913 'unit' => 'px',
914 'size' => 30,
915 ],
916 'selectors' => [
917 '{{WRAPPER}} .elementskit_inline_form .elementskit_input_wraper:not(:last-child)' => 'margin-right: {{SIZE}}{{UNIT}};',
918 ],
919 'condition' => [
920 'ekit_mail_chimp_form_style_switcher' => 'yes'
921 ]
922 ]
923 );
924
925 $this->add_responsive_control(
926 'inline_margin_bottom',
927 [
928 'label' => esc_html__( 'Margin Bottom', 'elementskit-lite' ),
929 'type' => Controls_Manager::SLIDER,
930 'devices' => ['desktop', 'mobile'],
931 'selectors' => [
932 '{{WRAPPER}} .has-extra-fields > .elementskit_input_wraper:not(:last-child)' => 'margin-bottom: {{SIZE}}{{UNIT}};',
933 ],
934 'condition' => [
935 'ekit_mail_chimp_form_style_switcher' => 'yes', // Inline Style
936 'ekit_mail_chimp_section_form_name_show' => 'yes', // Show Names
937 ]
938 ]
939 );
940
941 $this->add_control(
942 'ekit_mail_chimp_input_style_placeholder_heading',
943 [
944 'label' => esc_html__( 'Placeholder', 'elementskit-lite' ),
945 'type' => Controls_Manager::HEADING,
946 'separator' => 'before',
947 ]
948 );
949
950 $this->add_responsive_control(
951 'ekit_mail_chimp_input_style_placeholder_color',
952 [
953 'label' => esc_html__( 'Placeholder Color', 'elementskit-lite' ),
954 'type' => Controls_Manager::COLOR,
955 'default' => '#000000',
956 'selectors' => [
957 '{{WRAPPER}} .ekit_form_control::-webkit-input-placeholder' => 'color: {{VALUE}}',
958 '{{WRAPPER}} .ekit_form_control::-moz-placeholder' => 'color: {{VALUE}}',
959 '{{WRAPPER}} .ekit_form_control:-ms-input-placeholder' => 'color: {{VALUE}}',
960 '{{WRAPPER}} .ekit_form_control:-moz-placeholder' => 'color: {{VALUE}}',
961 ],
962 ]
963 );
964
965 $this->add_responsive_control(
966 'ekit_mail_chimp_input_style_placeholder_font_size',
967 [
968 'label' => esc_html__( 'Font Size', 'elementskit-lite' ),
969 'type' => Controls_Manager::SLIDER,
970 'size_units' => [ 'px' ],
971 'range' => [
972 'px' => [
973 'min' => 0,
974 'max' => 100,
975 'step' => 1,
976 ],
977 ],
978 'default' => [
979 'unit' => 'px',
980 'size' => 14,
981 ],
982 'selectors' => [
983 '{{WRAPPER}} .ekit_form_control::-webkit-input-placeholder' => 'font-size: {{SIZE}}{{UNIT}};',
984 '{{WRAPPER}} .ekit_form_control::-moz-placeholder' => 'font-size: {{SIZE}}{{UNIT}};',
985 '{{WRAPPER}} .ekit_form_control:-ms-input-placeholder' => 'font-size: {{SIZE}}{{UNIT}};',
986 '{{WRAPPER}} .ekit_form_control:-moz-placeholder' => 'font-size: {{SIZE}}{{UNIT}};',
987 ],
988 ]
989 );
990
991 $this->end_controls_section();
992
993 $this->start_controls_section(
994 'ekit_mail_chimp_button_style_holder',
995 [
996 'label' => esc_html__( 'Button', 'elementskit-lite' ),
997 'tab' => Controls_Manager::TAB_STYLE,
998 ]
999 );
1000
1001 $this->add_control(
1002 'ekit_mail_chimp_button_use_position',
1003 [
1004 'label' => esc_html__( 'Use Position', 'elementskit-lite' ),
1005 'type' => Controls_Manager::SWITCHER,
1006 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ),
1007 'label_off' => esc_html__( 'No', 'elementskit-lite' ),
1008 'return_value' => 'absolute',
1009 'default' => 'no',
1010 'selectors' => [
1011 '{{WRAPPER}} .ekit_submit_input_holder' => 'position: {{VALUE}};',
1012 ],
1013 ]
1014 );
1015
1016 $this->add_control(
1017 'ekit_mail_chimp_button_horizontal_position',
1018 [
1019 'label' => esc_html__( 'Horizontal Position', 'elementskit-lite' ),
1020 'type' => Controls_Manager::CHOOSE,
1021 'options' => [
1022 'left' => [
1023 'title' => esc_html__( 'Left', 'elementskit-lite' ),
1024 'icon' => 'eicon-h-align-left',
1025 ],
1026 'right' => [
1027 'title' => esc_html__( 'Right', 'elementskit-lite' ),
1028 'icon' => 'eicon-h-align-right',
1029 ],
1030 ],
1031 'default' => 'right',
1032 'toggle' => false,
1033 'condition' => [
1034 'ekit_mail_chimp_button_use_position' => 'absolute',
1035 ],
1036 ]
1037 );
1038
1039 $this->add_responsive_control(
1040 'ekit_mail_chimp_button_horizontal_offset',
1041 [
1042 'label' => esc_html__( 'Horizontal Offset', 'elementskit-lite' ),
1043 'type' => Controls_Manager::SLIDER,
1044 'size_units' => [ 'px', '%' ],
1045 'range' => [
1046 'px' => [
1047 'min' => -1000,
1048 'max' => 1000,
1049 'step' => 1,
1050 ],
1051 '%' => [
1052 'min' => -100,
1053 'max' => 100,
1054 ],
1055 ],
1056 'default' => [
1057 'unit' => 'px',
1058 'size' => 0,
1059 ],
1060 'selectors' => [
1061 '{{WRAPPER}} .ekit_submit_input_holder' => '{{ekit_mail_chimp_button_horizontal_position.VALUE}}: {{SIZE}}{{UNIT}};',
1062 ],
1063 'condition' => [
1064 'ekit_mail_chimp_button_use_position' => 'absolute',
1065 ],
1066 ]
1067 );
1068
1069 $this->add_control(
1070 'ekit_mail_chimp_button_vertical_position',
1071 [
1072 'label' => esc_html__( 'Vertical Position', 'elementskit-lite' ),
1073 'type' => Controls_Manager::CHOOSE,
1074 'options' => [
1075 'top' => [
1076 'title' => esc_html__( 'Top', 'elementskit-lite' ),
1077 'icon' => 'eicon-v-align-top',
1078 ],
1079 'bottom' => [
1080 'title' => esc_html__( 'Bottom', 'elementskit-lite' ),
1081 'icon' => 'eicon-v-align-bottom',
1082 ],
1083 ],
1084 'default' => 'top',
1085 'toggle' => false,
1086 'condition' => [
1087 'ekit_mail_chimp_button_use_position' => 'absolute',
1088 ],
1089 ]
1090 );
1091
1092 $this->add_responsive_control(
1093 'ekit_mail_chimp_button_vertical_offset',
1094 [
1095 'label' => esc_html__( 'Vertical Offset', 'elementskit-lite' ),
1096 'type' => Controls_Manager::SLIDER,
1097 'size_units' => [ 'px', '%' ],
1098 'range' => [
1099 'px' => [
1100 'min' => -1000,
1101 'max' => 1000,
1102 'step' => 1,
1103 ],
1104 '%' => [
1105 'min' => -100,
1106 'max' => 100,
1107 ],
1108 ],
1109 'default' => [
1110 'unit' => 'px',
1111 'size' => 0,
1112 ],
1113 'selectors' => [
1114 '{{WRAPPER}} .ekit_submit_input_holder' => '{{ekit_mail_chimp_button_vertical_position.VALUE}}: {{SIZE}}{{UNIT}};',
1115 ],
1116 'condition' => [
1117 'ekit_mail_chimp_button_use_position' => 'absolute',
1118 ],
1119 'separator' => 'after',
1120 ]
1121 );
1122
1123
1124 $this->add_group_control(
1125 Group_Control_Typography::get_type(),
1126 [
1127 'name' => 'ekit_mail_chimp_button_typography',
1128 'label' => esc_html__( 'Typography', 'elementskit-lite' ),
1129 'selector' => '{{WRAPPER}} .ekit-mail-submit',
1130 ]
1131 );
1132
1133
1134
1135
1136
1137 $this->add_responsive_control(
1138 'ekit_mail_chimp_button_border_radius',
1139 [
1140 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
1141 'type' => Controls_Manager::DIMENSIONS,
1142 'size_units' => [ 'px', '%', 'em' ],
1143 'selectors' => [
1144 '{{WRAPPER}} .ekit-mail-submit' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1145 ],
1146 ]
1147 );
1148
1149 $this->add_responsive_control(
1150 'ekit_mail_chimp_button_border_padding',
1151 [
1152 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
1153 'type' => Controls_Manager::DIMENSIONS,
1154 'size_units' => [ 'px', '%', 'em' ],
1155 'default' => [
1156 'top' => 8,
1157 'right' => 20,
1158 'bottom' => 8,
1159 'left' => 20
1160 ],
1161 'selectors' => [
1162 '{{WRAPPER}} .ekit-mail-submit' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1163 ],
1164 ]
1165 );
1166
1167 $this->add_group_control(
1168 Group_Control_Border::get_type(),
1169 [
1170 'name' => 'ekit_mail_chimp_button_border',
1171 'label' => esc_html__( 'Border', 'elementskit-lite' ),
1172 'selector' => '{{WRAPPER}} .ekit-mail-submit',
1173 ]
1174 );
1175
1176 $this->add_group_control(
1177 Group_Control_Text_Shadow::get_type(),
1178 [
1179 'name' => 'ekit_mail_chimp_button_title_shadow',
1180 'selector' => '{{WRAPPER}} .ekit-mail-submit' ,
1181 ]
1182 );
1183
1184 $this->add_control(
1185 'ekit_mail_chimp_button_style_use_width_height',
1186 [
1187 'label' => esc_html__( 'Use Width', 'elementskit-lite' ),
1188 'type' => Controls_Manager::SWITCHER,
1189 'label_on' => esc_html__( 'Show', 'elementskit-lite' ),
1190 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ),
1191 'return_value' => 'yes',
1192 'default' => 'no',
1193 ]
1194 );
1195
1196 $this->add_responsive_control(
1197 'ekit_mail_chimp_button_width',
1198 [
1199 'label' => esc_html__( 'Width', 'elementskit-lite' ),
1200 'type' => Controls_Manager::SLIDER,
1201 'size_units' => [ 'px', '%' ],
1202 'range' => [
1203 'px' => [
1204 'min' => 50,
1205 'max' => 1000,
1206 'step' => 1,
1207 ],
1208 '%' => [
1209 'min' => 10,
1210 'max' => 100,
1211 ],
1212 ],
1213 'default' => [
1214 'unit' => 'px',
1215 'size' => 50,
1216 ],
1217 'selectors' => [
1218 '{{WRAPPER}} .ekit-mail-submit' => 'width: {{SIZE}}{{UNIT}};',
1219 ],
1220 'condition' => [
1221 'ekit_mail_chimp_button_style_use_width_height' => 'yes'
1222 ]
1223 ]
1224 );
1225
1226
1227 $this->add_responsive_control(
1228 'ekit_mail_chimp_button_style_margin',
1229 [
1230 'label' => esc_html__( 'Margin', 'elementskit-lite' ),
1231 'type' => Controls_Manager::DIMENSIONS,
1232 'size_units' => [ 'px', '%', 'em' ],
1233 'selectors' => [
1234 '{{WRAPPER}} .ekit-mail-submit' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1235 ],
1236 ]
1237 );
1238
1239 $this->start_controls_tabs(
1240 'ekit_mail_chimp_button_normal_and_hover_tabs'
1241 );
1242 $this->start_controls_tab(
1243 'ekit_mail_chimp_button_normal_tab',
1244 [
1245 'label' => esc_html__( 'Normal', 'elementskit-lite' ),
1246 ]
1247 );
1248
1249 $this->add_responsive_control(
1250 'ekit_mail_chimp_button_color',
1251 [
1252 'label' => esc_html__( 'Color', 'elementskit-lite' ),
1253 'type' => Controls_Manager::COLOR,
1254 'default' => '#fff',
1255 'selectors' => [
1256 '{{WRAPPER}} .ekit-mail-submit' => 'color: {{VALUE}};',
1257 '{{WRAPPER}} .ekit-mail-submit svg' => 'fill: {{VALUE}};',
1258 ],
1259 ]
1260 );
1261
1262 $this->add_group_control(
1263 Group_Control_Background::get_type(),
1264 [
1265 'name' => 'ekit_mail_chimp_button_background',
1266 'label' => esc_html__( 'Background', 'elementskit-lite' ),
1267 'types' => [ 'classic', 'gradient', ],
1268 'selector' => '{{WRAPPER}} .ekit-mail-submit',
1269 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
1270 ]
1271 );
1272
1273 $this->add_group_control(
1274 Group_Control_Box_Shadow::get_type(),
1275 [
1276 'name' => 'ekit_mail_chimp_button_box_shadow',
1277 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
1278 'selector' => '{{WRAPPER}} .ekit-mail-submit',
1279 ]
1280 );
1281
1282 $this->end_controls_tab();
1283 $this->start_controls_tab(
1284 'ekit_mail_chimp_button_hover_tab',
1285 [
1286 'label' => esc_html__( 'Hover', 'elementskit-lite' ),
1287 ]
1288 );
1289
1290 $this->add_responsive_control(
1291 'ekit_mail_chimp_button_color_hover',
1292 [
1293 'label' => esc_html__( 'Color', 'elementskit-lite' ),
1294 'type' => Controls_Manager::COLOR,
1295 'default' => '#fff',
1296 'selectors' => [
1297 '{{WRAPPER}} .ekit-mail-submit:hover' => 'color: {{VALUE}};',
1298 '{{WRAPPER}} .ekit-mail-submit:hover svg' => 'fill: {{VALUE}};',
1299 ],
1300 ]
1301 );
1302
1303 $this->add_group_control(
1304 Group_Control_Background::get_type(),
1305 [
1306 'name' => 'ekit_mail_chimp_button_background_hover',
1307 'label' => esc_html__( 'Background', 'elementskit-lite' ),
1308 'types' => [ 'classic', 'gradient', ],
1309 'selector' => '{{WRAPPER}} .ekit-mail-submit:before',
1310 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
1311 ]
1312 );
1313
1314 $this->add_group_control(
1315 Group_Control_Box_Shadow::get_type(),
1316 [
1317 'name' => 'ekit_mail_chimp_button_hover_box_shadow',
1318 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ),
1319 'selector' => '{{WRAPPER}} .ekit-mail-submit:hover',
1320 ]
1321 );
1322
1323 $this->end_controls_tab();
1324
1325 $this->end_controls_tabs();
1326
1327 $this->add_control(
1328 'ekit_mail_chimp_button_icon_heading',
1329 [
1330 'label' => esc_html__( 'Icon', 'elementskit-lite' ),
1331 'type' => Controls_Manager::HEADING,
1332 'separator' => 'before',
1333 ]
1334 );
1335
1336 $this->add_responsive_control(
1337 'ekit_mail_chimp_button_icon_padding_right',
1338 [
1339 'label' => esc_html__( 'Icon Spacing', 'elementskit-lite' ),
1340 'type' => Controls_Manager::SLIDER,
1341 'size_units' => [ 'px' ],
1342 'range' => [
1343 'px' => [
1344 'min' => 0,
1345 'max' => 100,
1346 'step' => 1,
1347 ],
1348 ],
1349 'default' => [
1350 'unit' => 'px',
1351 'size' => 10,
1352 ],
1353 'selectors' => [
1354 '{{WRAPPER}} .ekit-mail-submit > i, {{WRAPPER}} .ekit-mail-submit > svg' => 'margin-right: {{SIZE}}{{UNIT}};',
1355 ],
1356 'condition' => [
1357 'ekit_mail_chimp_submit_icon_position' => 'before'
1358 ]
1359 ]
1360 );
1361
1362 $this->add_responsive_control(
1363 'ekit_mail_chimp_button_icon_padding_left',
1364 [
1365 'label' => esc_html__( 'Icon Spacing', 'elementskit-lite' ),
1366 'type' => Controls_Manager::SLIDER,
1367 'size_units' => [ 'px' ],
1368 'range' => [
1369 'px' => [
1370 'min' => 0,
1371 'max' => 100,
1372 'step' => 1,
1373 ],
1374 ],
1375 'default' => [
1376 'unit' => 'px',
1377 'size' => 10,
1378 ],
1379 'selectors' => [
1380 '{{WRAPPER}} .ekit-mail-submit > i, {{WRAPPER}} .ekit-mail-submit > svg' => 'margin-left: {{SIZE}}{{UNIT}};',
1381 ],
1382 'condition' => [
1383 'ekit_mail_chimp_submit_icon_position' => 'after'
1384 ]
1385 ]
1386 );
1387
1388 $this->add_responsive_control(
1389 'ekit_simple_tab_title_icon_size',
1390 [
1391 'label' => esc_html__( 'Icon Size', 'elementskit-lite' ),
1392 'type' => Controls_Manager::SLIDER,
1393 'size_units' => [ 'px', '%' ],
1394 'range' => [
1395 'px' => [
1396 'min' => 1,
1397 'max' => 100,
1398 'step' => 5,
1399 ],
1400 '%' => [
1401 'min' => 1,
1402 'max' => 100,
1403 ],
1404 ],
1405 'selectors' => [
1406 '{{WRAPPER}} .ekit-mail-submit > i, {{WRAPPER}} .ekit-mail-submit > i' => 'font-size: {{SIZE}}{{UNIT}};',
1407 '{{WRAPPER}} .ekit-mail-submit > i, {{WRAPPER}} .ekit-mail-submit > svg' => 'max-width: {{SIZE}}{{UNIT}}; height: auto',
1408 ],
1409 ]
1410 );
1411
1412 $this->end_controls_section();
1413
1414 $this->start_controls_section(
1415 'ekit_mail_chimp_input_icon_style_holder',
1416 [
1417 'label' => esc_html__( 'Input Icon', 'elementskit-lite' ),
1418 'tab' => Controls_Manager::TAB_STYLE,
1419 ]
1420 );
1421
1422 $this->add_group_control(
1423 Group_Control_Background::get_type(),
1424 [
1425 'name' => 'ekit_mail_chimp_input_icon_background',
1426 'label' => esc_html__( 'Background', 'elementskit-lite' ),
1427 'types' => [ 'classic', 'gradient' ],
1428 'selector' => '{{WRAPPER}} .elementskit_input_group_text',
1429 'exclude' => ['image'] // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
1430 ]
1431 );
1432
1433 $this->add_control(
1434 'ekit_mail_chimp_input_icon_color_hr',
1435 [
1436 'type' => Controls_Manager::DIVIDER,
1437 ]
1438 );
1439
1440 $this->add_responsive_control(
1441 'ekit_mail_chimp_input_icon_color',
1442 [
1443 'label' => esc_html__( 'Color', 'elementskit-lite' ),
1444 'type' => Controls_Manager::COLOR,
1445 'default' => '#000000',
1446 'selectors' => [
1447 '{{WRAPPER}} .elementskit_input_group_text i' => 'color: {{VALUE}};',
1448 '{{WRAPPER}} .elementskit_input_group_text svg' => 'fill: {{VALUE}};',
1449 ],
1450 ]
1451 );
1452
1453 $this->add_responsive_control(
1454 'ekit_mail_chimp_input_icon_font_size',
1455 [
1456 'label' => esc_html__( 'Icon Size', 'elementskit-lite' ),
1457 'type' => Controls_Manager::SLIDER,
1458 'size_units' => [ 'px' ],
1459 'range' => [
1460 'px' => [
1461 'min' => 0,
1462 'max' => 200,
1463 'step' => 1,
1464 ],
1465 ],
1466 'default' => [
1467 'unit' => 'px',
1468 'size' => 10,
1469 ],
1470 'selectors' => [
1471 '{{WRAPPER}} .elementskit_input_group_text' => 'font-size: {{SIZE}}{{UNIT}};',
1472 '{{WRAPPER}} .elementskit_input_group_text svg' => 'max-width: {{SIZE}}{{UNIT}};',
1473 ],
1474 ]
1475 );
1476
1477
1478 $this->add_group_control(
1479 Group_Control_Border::get_type(),
1480 [
1481 'name' => 'ekit_mail_chimp_input_icon_border',
1482 'label' => esc_html__( 'Border', 'elementskit-lite' ),
1483 'selector' => '{{WRAPPER}} .elementskit_input_group_text',
1484 ]
1485 );
1486
1487 $this->add_responsive_control(
1488 'ekit_mail_chimp_input_icon_padding',
1489 [
1490 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
1491 'type' => Controls_Manager::DIMENSIONS,
1492 'size_units' => [ 'px', '%', 'em' ],
1493 'selectors' => [
1494 '{{WRAPPER}} .elementskit_input_group_text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1495 ],
1496 ]
1497 );
1498
1499 $this->add_responsive_control(
1500 'ekit_mail_chimp_input_icon_border_radius',
1501 [
1502 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
1503 'type' => Controls_Manager::DIMENSIONS,
1504 'size_units' => [ 'px', '%', 'em' ],
1505 'selectors' => [
1506 '{{WRAPPER}} .elementskit_input_group_text' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1507 ],
1508 ]
1509 );
1510
1511 $this->end_controls_section();
1512
1513 $this->start_controls_section(
1514 'ekit_mail_chimp_success_error',
1515 [
1516 'label' => esc_html__( 'Success & Error message', 'elementskit-lite' ),
1517 'tab' => Controls_Manager::TAB_STYLE,
1518 ]
1519 );
1520
1521 $this->add_responsive_control(
1522 'ekit_mail_chimp_message_width',
1523 [
1524 'label' => esc_html__( 'Width', 'elementskit-lite' ),
1525 'type' => Controls_Manager::SLIDER,
1526 'size_units' => [ 'px', '%' ],
1527 'range' => [
1528 'px' => [
1529 'min' => 0,
1530 'max' => 1000,
1531 'step' => 1,
1532 ],
1533 '%' => [
1534 'min' => 0,
1535 'max' => 100,
1536 ],
1537 ],
1538 'default' => [
1539 'unit' => '%',
1540 'size' => 100,
1541 ],
1542 'selectors' => [
1543 '{{WRAPPER}} .ekit-mail-message' => 'width: {{SIZE}}{{UNIT}};',
1544 ],
1545 ]
1546 );
1547
1548 $this->add_responsive_control(
1549 'ekit_mail_chimp_success_error_padding',
1550 [
1551 'label' => esc_html__( 'Padding', 'elementskit-lite' ),
1552 'type' => Controls_Manager::DIMENSIONS,
1553 'size_units' => [ 'px', '%' ],
1554 'selectors' => [
1555 '{{WRAPPER}} .ekit-mail-message' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1556 ],
1557 ]
1558 );
1559
1560 $this->add_responsive_control(
1561 'ekit_mail_chimp_success_error_margin',
1562 [
1563 'label' => esc_html__( 'Margin', 'elementskit-lite' ),
1564 'type' => Controls_Manager::DIMENSIONS,
1565 'size_units' => [ 'px', '%' ],
1566 'selectors' => [
1567 '{{WRAPPER}} .ekit-mail-message' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1568 ],
1569 ]
1570 );
1571
1572 $this->add_control(
1573 'ekit_mail_chimp_success_error_border_radius',
1574 [
1575 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ),
1576 'type' => Controls_Manager::DIMENSIONS,
1577 'size_units' => [ 'px', '%', 'em' ],
1578 'selectors' => [
1579 '{{WRAPPER}} .ekit-mail-message' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1580 ]
1581 ]
1582 );
1583
1584 $this->add_group_control(
1585 Group_Control_Typography::get_type(), [
1586 'name' => 'ekit_mail_chimp_success_error_typography',
1587 'selector' => '{{WRAPPER}} .ekit-mail-message',
1588 ]
1589 );
1590
1591 $this->add_control(
1592 'ekit_mail_chimp_success_heading',
1593 [
1594 'label' => esc_html__( 'Success:', 'elementskit-lite' ),
1595 'type' => Controls_Manager::HEADING,
1596 ]
1597 );
1598
1599 $this->add_responsive_control(
1600 'ekit_mail_chimp_success_color', [
1601 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
1602 'type' => Controls_Manager::COLOR,
1603 'selectors' => [
1604 '{{WRAPPER}} .ekit-mail-message.success' => 'color: {{VALUE}};',
1605 ],
1606 ]
1607 );
1608
1609 $this->add_group_control(
1610 Group_Control_Background::get_type(),
1611 array(
1612 'name' => 'ekit_mail_chimp_success_bg_color',
1613 'label' => esc_html__( 'Background Color', 'elementskit-lite' ),
1614 'selector' => '{{WRAPPER}} .ekit-mail-message.success',
1615 )
1616 );
1617
1618 $this->add_group_control(
1619 Group_Control_Border::get_type(),
1620 [
1621 'name' => 'ekit_mail_chimp_success_border',
1622 'label' => esc_html__( 'Border', 'elementskit-lite' ),
1623 'selector' => '{{WRAPPER}} .ekit-mail-message.success',
1624 ]
1625 );
1626
1627 $this->add_control(
1628 'ekit_mail_chimp_error_heading',
1629 [
1630 'label' => esc_html__( 'Error:', 'elementskit-lite' ),
1631 'type' => Controls_Manager::HEADING,
1632 ]
1633 );
1634
1635 $this->add_responsive_control(
1636 'ekit_mail_chimp_error_color', [
1637 'label' =>esc_html__( 'Color', 'elementskit-lite' ),
1638 'type' => Controls_Manager::COLOR,
1639 'selectors' => [
1640 '{{WRAPPER}} .ekit-mail-message.error' => 'color: {{VALUE}};',
1641 ],
1642 ]
1643 );
1644
1645 $this->add_group_control(
1646 Group_Control_Background::get_type(),
1647 array(
1648 'name' => 'ekit_mail_chimp_error_bg_color',
1649 'label' => esc_html__( 'Background Color', 'elementskit-lite' ),
1650 'selector' => '{{WRAPPER}} .ekit-mail-message.error',
1651 )
1652 );
1653
1654 $this->add_group_control(
1655 Group_Control_Border::get_type(),
1656 [
1657 'name' => 'ekit_mail_chimp_error_border',
1658 'label' => esc_html__( 'Border', 'elementskit-lite' ),
1659 'selector' => '{{WRAPPER}} .ekit-mail-message.error',
1660 ]
1661 );
1662
1663
1664 $this->end_controls_section();
1665
1666 $this->insert_pro_message();
1667 }
1668
1669 protected function render_legacy_fields( $settings ) {
1670 extract($settings);
1671 if ( ! empty( $ekit_mail_chimp_fields_repeater ) ) {
1672 return;
1673 }
1674
1675 ?>
1676 <?php if(isset($ekit_mail_chimp_section_form_name_show) && $ekit_mail_chimp_section_form_name_show == 'yes'):?>
1677 <div class="ekit-mail-chimp-name elementskit_input_wraper elementskit_input_container">
1678 <div class="elementskit_form_group">
1679 <?php if($ekit_mail_chimp_first_name_label != ''): ?>
1680 <label class="elementskit_input_label"><?php echo esc_html( $ekit_mail_chimp_first_name_label );?> <span class="ekit_required_mark">*</span></label>
1681 <?php endif; ?>
1682 <div class="elementskit_input_element_container <?php if(($ekit_mail_chimp_first_name_icon_show == 'yes') && ($ekit_mail_chimp_first_name_icons != '')) : ?>elementskit_input_group<?php endif; ?>">
1683 <?php if(($ekit_mail_chimp_first_name_icon_show == 'yes') && ($ekit_mail_chimp_first_name_icons != '') && ($ekit_mail_chimp_first_name_icon_before_after == 'before')) : ?>
1684 <div class="elementskit_input_group_prepend">
1685 <div class="elementskit_input_group_text">
1686 <?php
1687 // new icon
1688 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_first_name_icons'] );
1689 // Check if its a new widget without previously selected icon using the old Icon control
1690 $is_new = empty( $settings['ekit_mail_chimp_first_name_icon'] );
1691 if ( $is_new || $migrated ) {
1692 // new icon
1693 Icons_Manager::render_icon( $settings['ekit_mail_chimp_first_name_icons'], [ 'aria-hidden' => 'true' ] );
1694 } else {
1695 ?>
1696 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_first_name_icon']); ?>" aria-hidden="true"></i>
1697 <?php
1698 }
1699 ?>
1700 </div>
1701 </div>
1702 <?php endif; ?>
1703 <input type="text" aria-label="<?php echo esc_attr__( 'First name', 'elementskit-lite' ); ?>" class="ekit_user_first ekit_form_control <?php if(($ekit_mail_chimp_first_name_icon_show == 'yes') && ($ekit_mail_chimp_first_name_icons != '') && ($ekit_mail_chimp_first_name_icon_before_after == 'after')) : ?> ekit_append_input <?php endif; ?>" name="firstname" placeholder="<?php echo esc_html( $ekit_mail_chimp_first_name_placeholder );?>" required />
1704
1705 <?php if(($ekit_mail_chimp_first_name_icon_show == 'yes') && ($ekit_mail_chimp_first_name_icons != '') && ($ekit_mail_chimp_first_name_icon_before_after == 'after')) : ?>
1706 <div class="elementskit_input_group_append">
1707 <div class="elementskit_input_group_text">
1708 <?php
1709 // new icon
1710 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_first_name_icons'] );
1711 // Check if its a new widget without previously selected icon using the old Icon control
1712 $is_new = empty( $settings['ekit_mail_chimp_first_name_icon'] );
1713 if ( $is_new || $migrated ) {
1714 // new icon
1715 Icons_Manager::render_icon( $settings['ekit_mail_chimp_first_name_icons'], [ 'aria-hidden' => 'true' ] );
1716 } else {
1717 ?>
1718 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_first_name_icon']); ?>" aria-hidden="true"></i>
1719 <?php
1720 }
1721 ?>
1722 </div>
1723 </div>
1724 <?php endif; ?>
1725 </div>
1726 </div>
1727 <?php // endif; ?>
1728 </div>
1729 <?php endif; ?>
1730 <?php if(isset($ekit_mail_chimp_section_form_name_show) && $ekit_mail_chimp_section_form_name_show == 'yes'):?>
1731 <div class="ekit-mail-chimp-name elementskit_input_wraper elementskit_input_container">
1732 <div class="elementskit_form_group">
1733
1734 <label class="elementskit_input_label"><?php echo esc_html( $ekit_mail_chimp_last_name_label ); ?> <span class="ekit_required_mark">*</span></label>
1735 <?php endif; ?>
1736 <div class="elementskit_input_element_container <?php if(($ekit_mail_chimp_last_name_icon_show == 'yes') && ($ekit_mail_chimp_last_name_icons != '')) : ?>elementskit_input_group<?php endif; ?>">
1737 <?php if(($ekit_mail_chimp_last_name_icon_show == 'yes') && ($ekit_mail_chimp_last_name_icons != '') && ($ekit_mail_chimp_last_name_icon_before_after == 'before')) : ?>
1738 <div class="elementskit_input_group_prepend">
1739 <div class="elementskit_input_group_text">
1740 <?php
1741 // new icon
1742 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_last_name_icons'] );
1743 // Check if its a new widget without previously selected icon using the old Icon control
1744 $is_new = empty( $settings['ekit_mail_chimp_last_name_icon'] );
1745 if ( $is_new || $migrated ) {
1746 // new icon
1747 Icons_Manager::render_icon( $settings['ekit_mail_chimp_last_name_icons'], [ 'aria-hidden' => 'true' ] );
1748 } else {
1749 ?>
1750 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_last_name_icon']); ?>" aria-hidden="true"></i>
1751 <?php
1752 }
1753 ?>
1754 </div>
1755 </div>
1756 <?php endif; ?>
1757 <input type="text" aria-label="<?php echo esc_attr__( 'Last name', 'elementskit-lite' ); ?>" class="ekit_user_last ekit_form_control <?php if(($ekit_mail_chimp_last_name_icon_show == 'yes') && ($ekit_mail_chimp_last_name_icons != '') && ($ekit_mail_chimp_last_name_icon_before_after == 'after')) : ?> ekit_append_input <?php endif; ?>" name="lastname" placeholder="<?php echo esc_html( $ekit_mail_chimp_last_name_placeholder );?>" required />
1758
1759 <?php if(($ekit_mail_chimp_last_name_icon_show == 'yes') && ($ekit_mail_chimp_last_name_icons != '') && ($ekit_mail_chimp_last_name_icon_before_after == 'after')) : ?>
1760 <div class="elementskit_input_group_append">
1761 <div class="elementskit_input_group_text">
1762 <?php
1763 // new icon
1764 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_last_name_icons'] );
1765 // Check if its a new widget without previously selected icon using the old Icon control
1766 $is_new = empty( $settings['ekit_mail_chimp_last_name_icon'] );
1767 if ( $is_new || $migrated ) {
1768 // new icon
1769 Icons_Manager::render_icon( $settings['ekit_mail_chimp_last_name_icons'], [ 'aria-hidden' => 'true' ] );
1770 } else {
1771 ?>
1772 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_last_name_icon']); ?>" aria-hidden="true"></i>
1773 <?php
1774 }
1775 ?>
1776 </div>
1777 </div>
1778 <?php endif; ?>
1779 </div>
1780 </div>
1781 <?php //endif; ?>
1782 </div>
1783 <?php
1784 if(isset($ekit_mail_chimp_section_form_phone_show) && $ekit_mail_chimp_section_form_phone_show == 'yes'):?>
1785 <div class="ekit-mail-chimp-phone elementskit_input_wraper elementskit_input_container">
1786 <div class="elementskit_form_group">
1787 <?php if($ekit_mail_chimp_phone_label != ''): ?>
1788 <label class="elementskit_input_label"><?php echo esc_html( $ekit_mail_chimp_phone_label );?> <span class="ekit_required_mark">*</span></label>
1789 <?php endif; ?>
1790 <div class="elementskit_input_element_container <?php if(($ekit_mail_chimp_phone_icon_show == 'yes') && ($ekit_mail_chimp_phone_icons != '')) : ?>elementskit_input_group<?php endif; ?>">
1791 <?php if(($ekit_mail_chimp_phone_icon_show == 'yes') && ($ekit_mail_chimp_phone_icons != '') && ($ekit_mail_chimp_phone_icon_before_after == 'before')) : ?>
1792 <div class="elementskit_input_group_prepend">
1793 <div class="elementskit_input_group_text">
1794 <?php
1795 // new icon
1796 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_phone_icons'] );
1797 // Check if its a new widget without previously selected icon using the old Icon control
1798 $is_new = empty( $settings['ekit_mail_chimp_phone_icon'] );
1799 if ( $is_new || $migrated ) {
1800 // new icon
1801 Icons_Manager::render_icon( $settings['ekit_mail_chimp_phone_icons'], [ 'aria-hidden' => 'true' ] );
1802 } else {
1803 ?>
1804 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_phone_icon']); ?>" aria-hidden="true"></i>
1805 <?php
1806 }
1807 ?>
1808 </div>
1809 </div>
1810 <?php endif; ?>
1811 <input type="tel" aria-label="<?php echo esc_attr__( 'Phone number', 'elementskit-lite' ); ?>" class="ekit_mail_phone ekit_form_control <?php if(($ekit_mail_chimp_phone_icon_show == 'yes') && ($ekit_mail_chimp_phone_icons != '') && ($ekit_mail_chimp_phone_icon_before_after == 'after')) : ?> ekit_append_input <?php endif; ?>" name="phone" placeholder="<?php echo esc_html( $ekit_mail_chimp_phone_placeholder ); ?>" required />
1812
1813 <?php if(($ekit_mail_chimp_phone_icon_show == 'yes') && ($ekit_mail_chimp_phone_icons != '') && ($ekit_mail_chimp_phone_icon_before_after == 'after')) : ?>
1814 <div class="elementskit_input_group_append">
1815 <div class="elementskit_input_group_text">
1816 <?php
1817 // new icon
1818 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_phone_icons'] );
1819 // Check if its a new widget without previously selected icon using the old Icon control
1820 $is_new = empty( $settings['ekit_mail_chimp_phone_icon'] );
1821 if ( $is_new || $migrated ) {
1822 // new icon
1823 Icons_Manager::render_icon( $settings['ekit_mail_chimp_phone_icons'], [ 'aria-hidden' => 'true' ] );
1824 } else {
1825 ?>
1826 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_phone_icon']); ?>" aria-hidden="true"></i>
1827 <?php
1828 }
1829 ?>
1830 </div>
1831 </div>
1832 <?php endif; ?>
1833 </div>
1834 </div>
1835 </div>
1836 <?php endif; ?>
1837 <div class="ekit-mail-chimp-email elementskit_input_wraper elementskit_input_container">
1838 <div class="elementskit_form_group">
1839 <?php if($ekit_mail_chimp_email_address_label != ''): ?>
1840 <label class="elementskit_input_label"><?php echo esc_html( $ekit_mail_chimp_email_address_label ); ?> <span class="ekit_required_mark">*</span></label>
1841 <?php endif; ?>
1842 <div class="elementskit_input_element_container <?php if(($ekit_mail_chimp_email_icon_show == 'yes') && ($ekit_mail_chimp_email_icons != '')) : ?>elementskit_input_group<?php endif; ?>">
1843 <?php if(($ekit_mail_chimp_email_icon_show == 'yes') && ($ekit_mail_chimp_email_icons != '') && ($ekit_mail_chimp_email_icon_before_after == 'before')) : ?>
1844 <div class="elementskit_input_group_prepend">
1845 <div class="elementskit_input_group_text">
1846 <?php
1847 // new icon
1848 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_email_icons'] );
1849 // Check if its a new widget without previously selected icon using the old Icon control
1850 $is_new = empty( $settings['ekit_mail_chimp_email_icon'] );
1851 if ( $is_new || $migrated ) {
1852 // new icon
1853 Icons_Manager::render_icon( $settings['ekit_mail_chimp_email_icons'], [ 'aria-hidden' => 'true' ] );
1854 } else {
1855 ?>
1856 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_email_icon']); ?>" aria-hidden="true"></i>
1857 <?php
1858 }
1859 ?>
1860 </div>
1861 </div>
1862 <?php endif; ?>
1863 <input type="email" aria-label="<?php echo esc_attr__( 'Email address', 'elementskit-lite' ); ?>" name="email" class="ekit_mail_email ekit_form_control <?php if(($ekit_mail_chimp_email_icon_show == 'yes') && ($ekit_mail_chimp_email_icons != '') && ($ekit_mail_chimp_email_icon_before_after == 'after')) : ?> ekit_append_input <?php endif; ?>" placeholder="<?php echo esc_html( $ekit_mail_chimp_email_address_placeholder ); ?>" required />
1864
1865 <?php if(($ekit_mail_chimp_email_icon_show == 'yes') && ($ekit_mail_chimp_email_icons != '') && ($ekit_mail_chimp_email_icon_before_after == 'after')) : ?>
1866 <div class="elementskit_input_group_append">
1867 <div class="elementskit_input_group_text">
1868 <?php
1869 // new icon
1870 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_email_icons'] );
1871 // Check if its a new widget without previously selected icon using the old Icon control
1872 $is_new = empty( $settings['ekit_mail_chimp_email_icon'] );
1873 if ( $is_new || $migrated ) {
1874 // new icon
1875 Icons_Manager::render_icon( $settings['ekit_mail_chimp_email_icons'], [ 'aria-hidden' => 'true' ] );
1876 } else {
1877 ?>
1878 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_email_icon']); ?>" aria-hidden="true"></i>
1879 <?php
1880 }
1881 ?>
1882 </div>
1883 </div>
1884 <?php endif; ?>
1885 </div>
1886 </div>
1887 </div>
1888 <?php
1889 }
1890
1891
1892
1893 /**
1894 * Recursively find and update ONLY the specific widget by ID
1895 */
1896
1897
1898 protected function render_repeater_fields( $settings ) {
1899
1900 extract($settings);
1901 if ( empty( $ekit_mail_chimp_fields_repeater ) ) {
1902 return;
1903 }
1904
1905 foreach ( $ekit_mail_chimp_fields_repeater as $index => $item ) :
1906 $field_type = $item['ekit_mail_chimp_field_type'];
1907 $field_label = $item['ekit_mail_chimp_field_label'];
1908 $field_placeholder = $item['ekit_mail_chimp_field_placeholder'];
1909 $is_required_attr = $item['ekit_mail_chimp_field_required'] === 'yes' ? 'required' : '';
1910 $field_name = $item['ekit_mail_chimp_field_name'];
1911 $show_icon = $item['ekit_mail_chimp_field_icon_show'] === 'yes';
1912 $icon_position = $item['ekit_mail_chimp_field_icon_position'];
1913 ?>
1914 <div class="elementskit_input_wraper elementskit_input_container key-<?php echo esc_attr($index); ?>">
1915 <div class="elementskit_form_group">
1916 <?php if ( ! empty($field_label) ) : ?>
1917 <label class="elementskit_input_label"><?php echo esc_html($field_label); ?> <?php if ( $is_required_attr ) : ?><span class="ekit_required_mark">*</span><?php endif; ?></label>
1918 <?php endif; ?>
1919 <div class="elementskit_input_element_container <?php echo $show_icon ? 'elementskit_input_group' : ''; ?>">
1920 <?php if ( $show_icon && $icon_position === 'before' ) : ?>
1921 <div class="elementskit_input_group_prepend">
1922 <div class="elementskit_input_group_text">
1923 <?php Icons_Manager::render_icon( $item['ekit_mail_chimp_field_icon'], [ 'aria-hidden' => 'true' ] ); ?>
1924 </div>
1925 </div>
1926 <?php endif; ?>
1927
1928 <?php if ( $field_type === 'textarea' ) : ?>
1929 <textarea
1930 class="ekit_form_control <?php echo ( $show_icon && $icon_position === 'after' ) ? 'ekit_append_input' : ''; ?>"
1931 name="<?php echo esc_attr( $field_name ); ?>"
1932 placeholder="<?php echo esc_attr( $field_placeholder ); ?>"
1933 <?php echo $is_required_attr ? 'required' : ''; ?>
1934 ></textarea>
1935 <?php else : ?>
1936 <input
1937 type="<?php echo esc_attr( $field_type ); ?>"
1938 class="ekit_form_control <?php echo esc_attr( ( $show_icon && $icon_position === 'after' ) ? 'ekit_append_input' : '' ); ?>"
1939 name="<?php echo esc_attr( $field_name ); ?>"
1940 placeholder="<?php echo esc_attr( $field_placeholder ); ?>"
1941 <?php echo $is_required_attr ? 'required' : ''; ?>
1942 >
1943 <?php endif; ?>
1944
1945 <?php if ( $show_icon && $icon_position === 'after' ) : ?>
1946 <div class="elementskit_input_group_append">
1947 <div class="elementskit_input_group_text">
1948 <?php Icons_Manager::render_icon( $item['ekit_mail_chimp_field_icon'], [ 'aria-hidden' => 'true' ] ); ?>
1949 </div>
1950 </div>
1951 <?php endif; ?>
1952 </div>
1953 </div>
1954 </div>
1955 <?php endforeach;
1956 }
1957
1958
1959 protected function render( ) {
1960 echo '<div class="ekit-wid-con" >';
1961 $this->render_raw();
1962 echo '</div>';
1963 }
1964 protected function render_raw( ) {
1965
1966 $settings = $this->get_settings_for_display();
1967 extract($settings);
1968
1969 $this->add_render_attribute(
1970 'content_wrapper',
1971 [
1972 'class' => 'elementskit_form_wraper'.($ekit_mail_chimp_form_style_switcher == 'yes' ? ' elementskit_inline_form' : '' ),
1973 ]
1974 );
1975 $this->add_render_attribute(
1976 'form',
1977 [
1978 'class' => 'ekit-mailChimpForm',
1979 'data-listed' => esc_attr($ekit_mail_chimp_select_listed_id),
1980 'data-success-message' => esc_attr($ekit_mail_chimp_success_message),
1981 'data-success-opt-in-message' => esc_attr($ekit_mail_chimp_opt_in_success_message),
1982 'data-nonce' => wp_create_nonce('wp_rest'),
1983 ]
1984 );
1985 ?>
1986 <div class="ekit-mail-chimp">
1987 <form method="post"
1988 <?php
1989 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Safe attribute string generated by Elementor.
1990 echo $this->get_render_attribute_string('form');
1991 ?>
1992 >
1993 <input type="hidden" name="double_opt_in" value="<?php echo esc_attr($ekit_mail_chimp_double_opt_in)?>">
1994
1995 <div <?php echo $this->get_render_attribute_string('content_wrapper'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped by elementor ?>>
1996 <?php
1997 $this->render_repeater_fields($settings);
1998 // $this->render_legacy_fields($settings);
1999 ?>
2000 <div class="ekit_submit_input_holder elementskit_input_wraper">
2001 <button type="submit" class="ekit-mail-submit" name="ekit_mail_chimp"><?php if(($ekit_mail_chimp_submit_icon_show == 'yes') && ($ekit_mail_chimp_submit_icons != '') && ($ekit_mail_chimp_submit_icon_position == 'before')): ?>
2002
2003 <?php
2004 // new icon
2005 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_submit_icons'] );
2006 // Check if its a new widget without previously selected icon using the old Icon control
2007 $is_new = empty( $settings['ekit_mail_chimp_submit_icon'] );
2008 if ( $is_new || $migrated ) {
2009 // new icon
2010 Icons_Manager::render_icon( $settings['ekit_mail_chimp_submit_icons'], [ 'aria-hidden' => 'true' ] );
2011 } else {
2012 ?>
2013 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_submit_icon']); ?>" aria-hidden="true"></i>
2014 <?php
2015 }
2016 ?>
2017
2018 <?php endif; ?><?php echo esc_html( $ekit_mail_chimp_submit );?><?php if(($ekit_mail_chimp_submit_icon_show == 'yes') && ($ekit_mail_chimp_submit_icons != '') && ($ekit_mail_chimp_submit_icon_position == 'after')): ?>
2019
2020 <?php
2021 // new icon
2022 $migrated = isset( $settings['__fa4_migrated']['ekit_mail_chimp_submit_icons'] );
2023 // Check if its a new widget without previously selected icon using the old Icon control
2024 $is_new = empty( $settings['ekit_mail_chimp_submit_icon'] );
2025 if ( $is_new || $migrated ) {
2026 // new icon
2027 Icons_Manager::render_icon( $settings['ekit_mail_chimp_submit_icons'], [ 'aria-hidden' => 'true' ] );
2028 } else {
2029 ?>
2030 <i class="<?php echo esc_attr($settings['ekit_mail_chimp_submit_icon']); ?>" aria-hidden="true"></i>
2031 <?php
2032 }
2033 ?>
2034
2035 <?php endif; ?></button>
2036 </div>
2037 </div>
2038 <div class="ekit-mail-message"></div>
2039 </form>
2040 </div>
2041 <?php
2042 }
2043
2044 /**
2045 * Check if this widget instance needs migration
2046 */
2047 protected function needs_migration() {
2048 $settings = $this->get_settings_for_display();
2049
2050 // Check if repeater is empty
2051 $repeater_empty = empty($settings['ekit_mail_chimp_fields_repeater']);
2052
2053 // Check if any legacy fields exist
2054 $has_legacy = (
2055 !empty($settings['ekit_mail_chimp_section_form_name_show']) ||
2056 !empty($settings['ekit_mail_chimp_section_form_phone_show']) ||
2057 !empty($settings['ekit_mail_chimp_email_address_label'])
2058 );
2059
2060 return $repeater_empty && $has_legacy;
2061 }
2062
2063 /**
2064 * Convert legacy fields to repeater format
2065 */
2066 protected function migrate_legacy_fields() {
2067 $settings = $this->get_settings_for_display();
2068 $repeater_fields = [];
2069
2070 foreach ($this->get_legacy_field_map() as $field) {
2071 // Skip disabled sections (except email)
2072 if (
2073 $field['show_key'] &&
2074 ($settings[$field['show_key']] ?? 'no') !== 'yes'
2075 ) {
2076 continue;
2077 }
2078
2079 $repeater_fields[] = $this->build_repeater_field($field, $settings);
2080 }
2081
2082
2083 return $repeater_fields;
2084 }
2085
2086 /**
2087 * Legacy field mapping definition
2088 */
2089 protected function get_legacy_field_map() {
2090 return [
2091 [
2092 'type' => 'text',
2093 'show_key' => 'ekit_mail_chimp_section_form_name_show',
2094 'label_key' => 'ekit_mail_chimp_first_name_label',
2095 'ph_key' => 'ekit_mail_chimp_first_name_placeholder',
2096 'icon_show' => 'ekit_mail_chimp_first_name_icon_show',
2097 'icon' => 'ekit_mail_chimp_first_name_icons',
2098 'icon_pos' => 'ekit_mail_chimp_first_name_icon_before_after',
2099 'default' => 'First Name',
2100 ],
2101 [
2102 'type' => 'text',
2103 'show_key' => 'ekit_mail_chimp_section_form_name_show',
2104 'label_key' => 'ekit_mail_chimp_last_name_label',
2105 'ph_key' => 'ekit_mail_chimp_last_name_placeholder',
2106 'icon_show' => 'ekit_mail_chimp_last_name_icon_show',
2107 'icon' => 'ekit_mail_chimp_last_name_icons',
2108 'icon_pos' => 'ekit_mail_chimp_last_name_icon_before_after',
2109 'default' => 'Last Name',
2110 ],
2111 [
2112 'type' => 'tel',
2113 'show_key' => 'ekit_mail_chimp_section_form_phone_show',
2114 'label_key' => 'ekit_mail_chimp_phone_label',
2115 'ph_key' => 'ekit_mail_chimp_phone_placeholder',
2116 'icon_show' => 'ekit_mail_chimp_phone_icon_show',
2117 'icon' => 'ekit_mail_chimp_phone_icons',
2118 'icon_pos' => 'ekit_mail_chimp_phone_icon_before_after',
2119 'default' => 'Phone',
2120 ],
2121 [
2122 'type' => 'email',
2123 'show_key' => null, // always enabled
2124 'label_key' => 'ekit_mail_chimp_email_address_label',
2125 'ph_key' => 'ekit_mail_chimp_email_address_placeholder',
2126 'icon_show' => 'ekit_mail_chimp_email_icon_show',
2127 'icon' => 'ekit_mail_chimp_email_icons',
2128 'icon_pos' => 'ekit_mail_chimp_email_icon_before_after',
2129 'default' => 'Email',
2130 ],
2131 ];
2132 }
2133
2134 /**
2135 * Build single repeater field from legacy settings
2136 */
2137 protected function build_repeater_field($field, $settings) {
2138 return [
2139 '_id' => wp_unique_id(),
2140 'ekit_mail_chimp_field_type' => $field['type'],
2141 'ekit_mail_chimp_field_label' => $settings[$field['label_key']] ?? $field['default'],
2142 'ekit_mail_chimp_field_placeholder' => $settings[$field['ph_key']] ?? $field['default'],
2143 'ekit_mail_chimp_field_name' => '',
2144 'ekit_mail_chimp_field_required' => 'yes',
2145 'ekit_mail_chimp_field_icon_show' => $settings[$field['icon_show']] ?? 'no',
2146 'ekit_mail_chimp_field_icon' => $settings[$field['icon']] ?? [],
2147 'ekit_mail_chimp_field_icon_position' => $settings[$field['icon_pos']] ?? 'before',
2148 ];
2149 }
2150 }
2151