PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.9.2.7
Advanced Custom Fields: Extended v0.9.2.7
0.9.2.7 0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / modules / form / module-form-action-email.php
acf-extended / includes / modules / form Last commit date
module-form-action-custom.php 9 months ago module-form-action-email.php 1 week ago module-form-action-post.php 3 months ago module-form-action-redirect.php 9 months ago module-form-action-term.php 3 months ago module-form-action-user.php 1 week ago module-form-action.php 3 months ago module-form-compatibility.php 3 months ago module-form-deprecated.php 1 year ago module-form-fields.php 3 months ago module-form-front-hooks.php 3 months ago module-form-front-render.php 1 week ago module-form-front.php 3 months ago module-form-shortcode.php 1 week ago module-form-upgrades.php 3 months ago module-form.php 3 months ago
module-form-action-email.php
996 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_module_form_action_email')):
8
9 class acfe_module_form_action_email extends acfe_module_form_action{
10
11 /**
12 * initialize
13 */
14 function initialize(){
15
16 $this->name = 'email';
17 $this->title = __('Email action', 'acfe');
18 $this->title_alt = __('Email', 'acfe');
19
20 $this->item = array(
21 'action' => 'email',
22 'name' => '',
23 'email' => array(
24 'from' => '',
25 'to' => '',
26 'reply_to' => '',
27 'cc' => '',
28 'bcc' => '',
29 'subject' => '',
30 'content' => '',
31 'html' => false, // content as raw html
32 'shortcode'=> false, // apply shortcodes
33 ),
34 'attachments' => array(
35 ),
36 );
37
38 }
39
40
41 /**
42 * prepare_action
43 *
44 * acfe/form/prepare_post:9
45 *
46 * @param $action
47 * @param $form
48 *
49 * @return array
50 */
51 function prepare_action($action, $form){
52
53 return $action;
54
55 }
56
57
58 /**
59 * make_action
60 *
61 * acfe/form/make_email:9
62 *
63 * @param $form
64 * @param $action
65 */
66 function make_action($form, $action){
67
68 // send email
69 $args = $this->process($form, $action);
70
71 if(!$args){
72 return;
73 }
74
75 // output
76 $this->generate_output($args, $form, $action);
77
78 // hooks
79 do_action("acfe/form/submit_email", $args, $form, $action);
80 do_action("acfe/form/submit_email/form={$form['name']}", $args, $form, $action);
81 do_action("acfe/form/submit_email/action={$action['name']}", $args, $form, $action);
82
83 }
84
85
86 /**
87 * process
88 *
89 * @param $form
90 * @param $action
91 *
92 * @return false
93 */
94 function process($form, $action){
95
96 // tags context
97 acfe_add_context(array('context' => 'display'));
98
99 // apply tags
100 acfe_apply_tags($action['email']['from']);
101 acfe_apply_tags($action['email']['to']);
102 acfe_apply_tags($action['email']['reply_to']);
103 acfe_apply_tags($action['email']['cc']);
104 acfe_apply_tags($action['email']['bcc']);
105 acfe_apply_tags($action['email']['subject']);
106 acfe_apply_tags($action['email']['content'], array('unformat' => 'wysiwyg'));
107
108 acfe_delete_context(array('context'));
109
110 // content: html
111 if($action['email']['html']){
112
113 // should apply shortcodes
114 if($action['email']['shortcode']){
115 $action['email']['content'] = do_shortcode($action['email']['content']);
116 }
117
118 // content: wysiwyg
119 }else{
120
121 // flag
122 $shortcode_disabled = false;
123
124 // check if shortcodes should be disabled
125 // and check if acf_the_content has do_shortcode filter
126 if(empty($action['email']['shortcode']) && has_filter('acf_the_content', 'do_shortcode', 11)){
127
128 $shortcode_disabled = true; // set flag
129 remove_filter('acf_the_content', 'do_shortcode', 11);
130
131 }
132
133 // apply the_content filters (autop, etc.)
134 $action['email']['content'] = apply_filters('acf_the_content', $action['email']['content']);
135
136 // re-add shortcode filter
137 if($shortcode_disabled){
138 add_filter('acf_the_content', 'do_shortcode', 11);
139 }
140
141 }
142
143 // args
144 $args = $action['email'];
145
146 // headers
147 $args['headers'] = $this->get_headers($action);
148
149 // attachments
150 $attachments = $this->get_attachments($action);
151 $args['attachments'] = $attachments['attachments'];
152 $args['delete_files'] = $attachments['delete_files'];
153
154 // filters
155 $args = apply_filters("acfe/form/submit_email_args", $args, $form, $action);
156 $args = apply_filters("acfe/form/submit_email_args/form={$form['name']}", $args, $form, $action);
157 $args = apply_filters("acfe/form/submit_email_args/action={$action['name']}", $args, $form, $action);
158
159 // bail early
160 if($args === false){
161 return false;
162 }
163
164 // attachements/delete_files might have been deleted by filters
165 // reset to empty array if not set
166 if(!isset($args['attachments']) || empty($args['attachments'])){
167 $args['attachments'] = array();
168 }
169
170 if(!isset($args['delete_files']) || empty($args['delete_files'])){
171 $args['delete_files'] = array();
172 }
173
174 // check arguments change after filters
175 // re-construct headers with new arguments if needed
176 $args = $this->validate_headers($args, $action);
177
178 // send email
179 wp_mail($args['to'], $args['subject'], $args['content'], $args['headers'], $args['attachments']);
180
181 // delete files
182 foreach($args['delete_files'] as $file_id){
183 wp_delete_attachment($file_id, true);
184 }
185
186 return $args;
187
188 }
189
190
191 /**
192 * get_headers
193 *
194 * @param $action
195 *
196 * @return array
197 */
198 function get_headers($action){
199
200 // fields
201 $fields = array(
202 array('name' => 'From', 'value' => $action['email']['from']),
203 array('name' => 'Reply-To', 'value' => $action['email']['reply_to']),
204 array('name' => 'Cc', 'value' => $action['email']['cc']),
205 array('name' => 'Bcc', 'value' => $action['email']['bcc']),
206 array('name' => 'Content-Type', 'value' => 'text/html'),
207 );
208
209 // headers
210 $headers = array();
211
212 // construct headers
213 foreach($fields as $field){
214
215 // From: email@domain.com
216 if(!empty($field['value'])){
217 $headers[] = "{$field['name']}: {$field['value']}";
218 }
219
220 }
221
222 // return
223 return $headers;
224
225 }
226
227
228 /**
229 * get_attachments
230 *
231 * @param $action
232 *
233 * @return array[]
234 */
235 function get_attachments($action){
236
237 // attachments
238 $attachments = array();
239 $delete_files = array();
240
241 /**
242 * $action[attachments] => Array(
243 * [0] => Array(
244 * [file] => {field:field_626202af1fbcd}
245 * [delete] => true
246 * )
247 * [1] => 36,
248 * [2] => 52,
249 * )
250 */
251
252 // construct attachments
253 foreach($action['attachments'] as $row){
254
255 // files
256 if(is_array($row)){
257
258 // vars
259 $file_id = $row['file'];
260 $delete = $row['delete'];
261
262 // files
263 $file_id = acfe_parse_tags($file_id, array('context' => 'save', 'format' => false, 'return' => 'raw')); // parse tags (unformatted + raw)
264 $files = acfe_as_array($file_id);
265
266 // deprecated
267 // just in case someone pass a file array in filters
268 if(isset($files['ID'])){
269 $files = array($files);
270 }
271
272 foreach($files as $file){
273
274 $attachment_id = false;
275 $attachment_path = false;
276 $is_numeric = false;
277
278 // numeric
279 if(is_numeric($file)){
280 $is_numeric = true;
281 $attachment_id = $file;
282 $attachment_path = get_attached_file($file);
283
284 // array
285 }elseif(is_array($file) && isset($file['ID'])){
286 $attachment_id = $file['ID'];
287 $attachment_path = get_attached_file($file['ID']);
288
289 // url
290 }else{
291
292 // retrieve url from path/url
293 $path = acfe_locate_file_url($file);
294 $attachment_id = attachment_url_to_postid($path);
295
296 if($attachment_id){
297 $attachment_path = get_attached_file($attachment_id);
298 }
299
300 }
301
302 // add to attachments array
303 if($attachment_id && $attachment_path){
304 $attachments[] = $attachment_path;
305
306 if($delete){
307
308 // check the current user can delete the attachment
309 if($is_numeric && !current_user_can('delete_post', $attachment_id)){
310 continue;
311 }
312
313 $delete_files[] = $attachment_id;
314
315 }
316 }
317
318 }
319
320 // static files
321 }else{
322
323 $attachment_path = false;
324
325 // numeric
326 if(is_numeric($row)){
327 $attachment_path = get_attached_file($row);
328
329 // url
330 }else{
331
332 // retrieve url from path/url
333 $path = acfe_locate_file_url($row);
334 $attachment_id = attachment_url_to_postid($path);
335
336 if($attachment_id){
337 $attachment_path = get_attached_file($attachment_id);
338 }
339
340 }
341
342 // add to attachments array
343 if($attachment_path){
344 $attachments[] = $attachment_path;
345 }
346
347 }
348
349 }
350
351 return array(
352 'attachments' => $attachments,
353 'delete_files' => $delete_files,
354 );
355
356 }
357
358
359 /**
360 * validate_headers
361 *
362 * @param $args
363 * @param $action
364 */
365 function validate_headers($args, $action){
366
367 // fields
368 $fields = array(
369 'from' => 'From:',
370 'reply_to' => 'Reply-To:',
371 'cc' => 'Cc:',
372 'bcc' => 'Bcc:',
373 );
374
375 // loop fields
376 foreach($fields as $slug => $label){
377
378 // vars
379 $action_value = $action['email'][ $slug ]; // get $action['email']['from']
380 $args_value = acfe_get($args, $slug); // get $args['from']
381
382 // check args value changed compared to action value
383 if($args_value && $args_value !== $action_value){
384
385 // loop $args['headers']
386 foreach(array_keys($args['headers']) as $i){
387
388 // headers row starts with "From:..."
389 if(acfe_starts_with($args['headers'][ $i ], $label)){
390 $args['headers'][ $i ] = "{$label} {$args_value}";
391 break;
392 }
393
394 }
395
396 }
397
398 }
399
400 return $args;
401
402 }
403
404
405 /**
406 * generate_output
407 *
408 * @param $args
409 * @param $form
410 * @param $action
411 */
412 function generate_output($args, $form, $action){
413
414 // filters
415 $args = apply_filters("acfe/form/submit_email_output", $args, $form, $action);
416 $args = apply_filters("acfe/form/submit_email_output/form={$form['name']}", $args, $form, $action);
417 $args = apply_filters("acfe/form/submit_email_output/action={$action['name']}", $args, $form, $action);
418
419 // action output
420 $this->set_action_output($args, $action);
421
422 }
423
424
425 /**
426 * prepare_load_action
427 *
428 * acfe/module/prepare_load_action
429 *
430 * @param $action
431 *
432 * @return array
433 */
434 function prepare_load_action($action){
435
436 // email loop
437 foreach(array_keys($action['email']) as $k){
438 $action["email_{$k}"] = $action['email'][ $k ];
439 }
440
441 // content group
442 $value = $action['email']['content'];
443
444 if($action['email']['html']){
445 $action['email_content_group']['email_content_type'] = 'html';
446 $action['email_content_group']['email_content_html'] = $value;
447 }else{
448 $action['email_content_group']['email_content_type'] = 'editor';
449 $action['email_content_group']['email_content_editor'] = $value;
450 }
451
452 // content shortcode
453 $action['email_content_group']['email_content_shortcode'] = $action['email']['shortcode'];
454
455 // clone var
456 $attachments = $action['attachments'];
457
458 // reset
459 $action['files'] = array();
460 $action['files_static'] = array();
461
462 foreach($attachments as $row){
463
464 // string (files_static)
465 if(!is_array($row)){
466 $action['files_static'][] = array('file_static' => $row);
467
468 //array (files)
469 }else{
470
471 $action['files'][] = array(
472 'files_file' => $row['file'],
473 'files_delete' => $row['delete'],
474 );
475
476 }
477
478 }
479
480 return $action;
481
482 }
483
484
485 /**
486 * prepare_save_action
487 *
488 * acfe/module/prepare_save_action
489 *
490 * @param $action
491 * @param $item
492 *
493 * @return mixed
494 */
495 function prepare_save_action($action){
496
497 $save = $this->item;
498
499 // general
500 $save['name'] = $action['name'];
501
502 // email loop
503 foreach(array_keys($save['email']) as $k){
504
505 // from => email_from
506 if(acfe_get($action, "email_{$k}")){
507 $save['email'][ $k ] = $action["email_{$k}"];
508 }
509
510 }
511
512 // content group
513 $group = $action['email_content_group'];
514
515 // content type: editor
516 if($group['content_type'] === 'editor'){
517 $save['email']['content'] = $group['content_editor'];
518
519 // content type: html
520 }elseif($group['content_type'] === 'html'){
521 $save['email']['content'] = $group['content_html'];
522 $save['email']['html'] = true;
523 }
524
525 // content shortcode
526 $save['email']['shortcode'] = $group['content_shortcode'];
527
528 // files
529 $action['files'] = acfe_as_array($action['files']);
530 $action['files_static'] = acfe_as_array($action['files_static']);
531
532 foreach($action['files'] as $row){
533 $save['attachments'][] = $row;
534 }
535
536 foreach($action['files_static'] as $row){
537 $save['attachments'][] = $row['file'];
538 }
539
540 return $save;
541
542 }
543
544
545 /**
546 * register_layout
547 *
548 * @param $layout
549 *
550 * @return array
551 */
552 function register_layout($layout){
553
554 return array(
555
556 /**
557 * documentation
558 */
559 array(
560 'key' => 'field_doc',
561 'label' => '',
562 'name' => '',
563 'type' => 'acfe_dynamic_render',
564 'instructions' => '',
565 'required' => 0,
566 'conditional_logic' => 0,
567 'wrapper' => array(
568 'width' => '',
569 'class' => '',
570 'id' => '',
571 ),
572 'render' => function(){
573 echo '<a href="https://www.acf-extended.com/features/modules/dynamic-forms/e-mail-action" target="_blank">' . __('Documentation', 'acfe') . '</a>';
574 }
575 ),
576
577 /**
578 * action
579 */
580 array(
581 'key' => 'field_tab_action',
582 'label' => __('Action', 'acfe'),
583 'name' => '',
584 'type' => 'tab',
585 'instructions' => '',
586 'required' => 0,
587 'conditional_logic' => 0,
588 'wrapper' => array(
589 'width' => '',
590 'class' => '',
591 'id' => '',
592 'data-no-preference' => true,
593 ),
594 'placement' => 'top',
595 'endpoint' => 0,
596 ),
597 array(
598 'key' => 'field_name',
599 'label' => __('Action name', 'acfe'),
600 'name' => 'name',
601 'type' => 'acfe_slug',
602 'instructions' => __('(Optional) Target this action using hooks.', 'acfe'),
603 'required' => 0,
604 'conditional_logic' => 0,
605 'wrapper' => array(
606 'width' => '',
607 'class' => '',
608 'id' => '',
609 'data-instruction-placement' => 'field'
610 ),
611 'default_value' => '',
612 'placeholder' => __('Email', 'acfe'),
613 'prepend' => '',
614 'append' => '',
615 'maxlength' => '',
616 ),
617
618 /**
619 * email
620 */
621 array(
622 'key' => 'field_tab_email',
623 'label' => __('Email', 'acfe'),
624 'name' => '',
625 'type' => 'tab',
626 'instructions' => '',
627 'required' => 0,
628 'conditional_logic' => 0,
629 'wrapper' => array(
630 'width' => '',
631 'class' => '',
632 'id' => '',
633 ),
634 'placement' => 'top',
635 'endpoint' => 0,
636 ),
637 array(
638 'key' => 'field_email_from',
639 'label' => __('From', 'acfe'),
640 'name' => 'email_from',
641 'type' => 'text',
642 'instructions' => '',
643 'required' => 0,
644 'conditional_logic' => 0,
645 'wrapper' => array(
646 'width' => '',
647 'class' => '',
648 'id' => '',
649 ),
650 'default_value' => '',
651 'placeholder' => __('Name <email@domain.com>', 'acfe'),
652 'prepend' => '',
653 'append' => '',
654 'maxlength' => '',
655 ),
656 array(
657 'key' => 'field_email_to',
658 'label' => __('To', 'acfe'),
659 'name' => 'email_to',
660 'type' => 'text',
661 'instructions' => '',
662 'required' => 0,
663 'conditional_logic' => 0,
664 'wrapper' => array(
665 'width' => '',
666 'class' => '',
667 'id' => '',
668 ),
669 'default_value' => '',
670 'placeholder' => __('email@domain.com', 'acfe'),
671 'prepend' => '',
672 'append' => '',
673 ),
674 array(
675 'key' => 'field_email_reply_to',
676 'label' => __('Reply to', 'acfe'),
677 'name' => 'email_reply_to',
678 'type' => 'text',
679 'instructions' => '',
680 'required' => 0,
681 'conditional_logic' => 0,
682 'wrapper' => array(
683 'width' => '',
684 'class' => '',
685 'id' => '',
686 ),
687 'default_value' => '',
688 'placeholder' => __('Name <email@domain.com>', 'acfe'),
689 'prepend' => '',
690 'append' => '',
691 'maxlength' => '',
692 ),
693 array(
694 'key' => 'field_email_cc',
695 'label' => __('Cc', 'acfe'),
696 'name' => 'email_cc',
697 'type' => 'text',
698 'instructions' => '',
699 'required' => 0,
700 'conditional_logic' => 0,
701 'wrapper' => array(
702 'width' => '',
703 'class' => '',
704 'id' => '',
705 ),
706 'default_value' => '',
707 'placeholder' => __('email@domain.com', 'acfe'),
708 'prepend' => '',
709 'append' => '',
710 'maxlength' => '',
711 ),
712 array(
713 'key' => 'field_email_bcc',
714 'label' => __('Bcc', 'acfe'),
715 'name' => 'email_bcc',
716 'type' => 'text',
717 'instructions' => '',
718 'required' => 0,
719 'conditional_logic' => 0,
720 'wrapper' => array(
721 'width' => '',
722 'class' => '',
723 'id' => '',
724 ),
725 'default_value' => '',
726 'placeholder' => __('email@domain.com', 'acfe'),
727 'prepend' => '',
728 'append' => '',
729 'maxlength' => '',
730 ),
731 array(
732 'key' => 'field_email_subject',
733 'label' => __('Subject', 'acfe'),
734 'name' => 'email_subject',
735 'type' => 'text',
736 'instructions' => '',
737 'required' => 0,
738 'conditional_logic' => 0,
739 'wrapper' => array(
740 'width' => '',
741 'class' => '',
742 'id' => '',
743 ),
744 'default_value' => '',
745 'placeholder' => '',
746 'prepend' => '',
747 'append' => '',
748 'maxlength' => '',
749 ),
750
751 array(
752 'key' => 'field_email_content_group',
753 'label' => __('Content', 'acfe'),
754 'name' => 'email_content_group',
755 'type' => 'group',
756 'instructions' => __('Render customized email content.', 'acfe') . '<br /><br />' .
757 __('Render all fields values:' ,'acfe') . '<br /><code>{fields}</code><br/><br/>' .
758 __('Render field value:', 'acfe') . '<br /><code>{field:field_abc123}</code><br/><code>{field:my_field}</code>',
759 'required' => 0,
760 'conditional_logic' => array(),
761 'wrapper' => array(
762 'width' => '',
763 'class' => '',
764 'id' => '',
765 ),
766 'layout' => 'block',
767 'acfe_seamless_style' => true,
768 'acfe_group_modal' => 0,
769 'sub_fields' => array(
770 array(
771 'key' => 'field_email_content_type',
772 'label' => '',
773 'name' => 'content_type',
774 'type' => 'select',
775 'instructions' => '',
776 'required' => 0,
777 'conditional_logic' => 0,
778 'wrapper' => array(
779 'width' => '65%',
780 'class' => '',
781 'id' => '',
782 ),
783 'choices' => array(
784 'editor' => __('Content Editor', 'acfe'),
785 'html' => __('Raw HTML', 'acfe'),
786 ),
787 'default_value' => array('custom'),
788 'allow_null' => 0,
789 'multiple' => 0,
790 'ui' => 0,
791 'return_format' => 'value',
792 'placeholder' => __('Default', 'acfe'),
793 'ajax' => 0,
794 'allow_custom' => 0,
795 ),
796 array(
797 'key' => 'field_email_content_shortcode',
798 'label' => '',
799 'name' => 'content_shortcode',
800 'type' => 'true_false',
801 'instructions' => '',
802 'required' => 0,
803 'wrapper' => array(
804 'width' => '35%',
805 'class' => '',
806 'id' => '',
807 ),
808 'message' => __('Apply shortcodes', 'acfe'),
809 'default_value' => 0,
810 'ui' => false,
811 'ui_on_text' => '',
812 'ui_off_text' => '',
813 ),
814 array(
815 'key' => 'field_email_content_editor',
816 'label' => '',
817 'name' => 'content_editor',
818 'type' => 'wysiwyg',
819 'instructions' => '',
820 'required' => 0,
821 'conditional_logic' => array(
822 array(
823 array(
824 'field' => 'field_email_content_type',
825 'operator' => '==',
826 'value' => 'editor',
827 ),
828 ),
829 ),
830 'wrapper' => array(
831 'width' => '',
832 'class' => '',
833 'id' => '',
834 ),
835 'default_value' => '',
836 'tabs' => 'all',
837 'toolbar' => 'full',
838 'media_upload' => 1,
839 'delay' => 0,
840 ),
841 array(
842 'key' => 'field_email_content_html',
843 'label' => '',
844 'name' => 'content_html',
845 'type' => 'acfe_code_editor',
846 'instructions' => '',
847 'required' => 0,
848 'conditional_logic' => array(
849 array(
850 array(
851 'field' => 'field_email_content_type',
852 'operator' => '==',
853 'value' => 'html',
854 ),
855 ),
856 ),
857 'wrapper' => array(
858 'width' => '',
859 'class' => '',
860 'id' => '',
861 ),
862 'default_value' => '',
863 'rows' => 18,
864 ),
865 ),
866 ),
867
868 /**
869 * attachments
870 */
871 array(
872 'key' => 'field_tab_attachments',
873 'label' => __('Attachments', 'acfe'),
874 'name' => '',
875 'type' => 'tab',
876 'instructions' => '',
877 'required' => 0,
878 'conditional_logic' => 0,
879 'wrapper' => array(
880 'width' => '',
881 'class' => '',
882 'id' => '',
883 ),
884 'placement' => 'top',
885 'endpoint' => 0,
886 ),
887 array(
888 'key' => 'field_files',
889 'label' => __('Dynamic files', 'acfe'),
890 'name' => 'files',
891 'type' => 'repeater',
892 'instructions' => '',
893 'required' => 0,
894 'conditional_logic' => 0,
895 'wrapper' => array(
896 'width' => '',
897 'class' => '',
898 'id' => '',
899 ),
900 'collapsed' => '',
901 'min' => 0,
902 'max' => 0,
903 'layout' => 'table',
904 'button_label' => __('Add file', 'acfe'),
905 'sub_fields' => array(
906 array(
907 'key' => 'field_files_file',
908 'label' => __('File', 'acfe'),
909 'name' => 'file',
910 'type' => 'select',
911 'instructions' => '',
912 'required' => 0,
913 'conditional_logic' => 0,
914 'wrapper' => array(
915 'width' => '',
916 'class' => '',
917 'id' => '',
918 ),
919 'choices' => array(),
920 'default_value' => array(),
921 'allow_null' => 0,
922 'multiple' => 0,
923 'ui' => 1,
924 'return_format' => 'value',
925 'ajax' => 1,
926 'placeholder' => '',
927 'search_placeholder' => __('Select a field or enter a custom value/template tag.', 'acfe'),
928 'allow_custom' => 1,
929 'ajax_action' => 'acfe/form/map_field_ajax',
930 ),
931 array(
932 'key' => 'field_files_delete',
933 'label' => __('Delete file', 'acfe'),
934 'name' => 'delete',
935 'type' => 'true_false',
936 'instructions' => '',
937 'required' => 0,
938 'wrapper' => array(
939 'width' => '',
940 'class' => '',
941 'id' => '',
942 ),
943 'message' => __('Delete file once sent', 'acfe'),
944 'default_value' => 0,
945 'ui' => 1,
946 'ui_on_text' => '',
947 'ui_off_text' => '',
948 ),
949 ),
950 ),
951 array(
952 'key' => 'field_files_static',
953 'label' => __('Static files', 'acfe'),
954 'name' => 'files_static',
955 'type' => 'repeater',
956 'instructions' => '',
957 'required' => 0,
958 'conditional_logic' => 0,
959 'wrapper' => array(
960 'width' => '',
961 'class' => '',
962 'id' => '',
963 ),
964 'collapsed' => '',
965 'min' => 0,
966 'max' => 0,
967 'layout' => 'table',
968 'button_label' => __('Add file', 'acfe'),
969 'sub_fields' => array(
970 array(
971 'key' => 'field_file_static',
972 'label' => __('File', 'acfe'),
973 'name' => 'file',
974 'type' => 'file',
975 'instructions' => '',
976 'required' => 0,
977 'conditional_logic' => 0,
978 'wrapper' => array(
979 'width' => '',
980 'class' => '',
981 'id' => '',
982 ),
983 'return_format' => 'id',
984 ),
985 ),
986 ),
987
988 );
989
990 }
991
992 }
993
994 acfe_register_form_action_type('acfe_module_form_action_email');
995
996 endif;