| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Get form fields of contact form template |
| 5 |
* |
| 6 |
* @since 1.0.0-beta.3 |
| 7 |
* |
| 8 |
* @return array |
| 9 |
*/ |
| 10 |
function weforms_get_contactform_template_fields() { |
| 11 |
$conditionals = array( |
| 12 |
'condition_status' => 'no', |
| 13 |
'cond_field' => array(), |
| 14 |
'cond_operator' => array( '=' ), |
| 15 |
'cond_option' => array( '- select -' ), |
| 16 |
'cond_logic' => 'all' |
| 17 |
); |
| 18 |
|
| 19 |
return array( |
| 20 |
array( |
| 21 |
'input_type' => 'name', |
| 22 |
'template' => 'name_field', |
| 23 |
'required' => 'yes', |
| 24 |
'label' => __( 'Name', 'weforms' ), |
| 25 |
'name' => 'name', |
| 26 |
'is_meta' => 'yes', |
| 27 |
'format' => 'first-last', |
| 28 |
'first_name' => array( |
| 29 |
'placeholder' => '', |
| 30 |
'default' => '', |
| 31 |
'sub' => __( 'First', 'weforms' ), |
| 32 |
), |
| 33 |
'middle_name' => array( |
| 34 |
'placeholder' => '', |
| 35 |
'default' => '', |
| 36 |
'sub' => __( 'Middle', 'weforms' ), |
| 37 |
), |
| 38 |
'last_name' => array( |
| 39 |
'placeholder' => '', |
| 40 |
'default' => '', |
| 41 |
'sub' => __( 'Last', 'weforms' ), |
| 42 |
), |
| 43 |
'hide_subs' => '', |
| 44 |
'help' => '', |
| 45 |
'css' => '', |
| 46 |
'wpuf_cond' => $conditionals |
| 47 |
), |
| 48 |
array( |
| 49 |
'input_type' => 'text', |
| 50 |
'template' => 'email_address', |
| 51 |
'required' => 'yes', |
| 52 |
'label' => __( 'Email', 'weforms' ), |
| 53 |
'name' => 'email', |
| 54 |
'is_meta' => 'yes', |
| 55 |
'help' => '', |
| 56 |
'css' => '', |
| 57 |
'placeholder' => '', |
| 58 |
'default' => '', |
| 59 |
'size' => 40, |
| 60 |
'wpuf_cond' => $conditionals |
| 61 |
), |
| 62 |
array( |
| 63 |
'input_type' => 'textarea', |
| 64 |
'template' => 'textarea_field', |
| 65 |
'required' => 'yes', |
| 66 |
'label' => __( 'Message', 'weforms' ), |
| 67 |
'name' => 'message', |
| 68 |
'is_meta' => 'yes', |
| 69 |
'help' => '', |
| 70 |
'css' => '', |
| 71 |
'rows' => 5, |
| 72 |
'cols' => 25, |
| 73 |
'placeholder' => '', |
| 74 |
'default' => '', |
| 75 |
'rich' => 'no', |
| 76 |
'word_restriction' => '', |
| 77 |
'wpuf_cond' => $conditionals |
| 78 |
), |
| 79 |
); |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* Get settings of contact form template |
| 84 |
* |
| 85 |
* @since 1.0.0-beta.3 |
| 86 |
* |
| 87 |
* @return array |
| 88 |
*/ |
| 89 |
function weforms_get_contactform_template_settings() { |
| 90 |
return array( |
| 91 |
'redirect_to' => 'same', |
| 92 |
'message' => __( 'Thanks for contacting us! We will get in touch with you shortly.', 'weforms' ), |
| 93 |
'page_id' => '', |
| 94 |
'url' => '', |
| 95 |
'submit_text' => __( 'Submit Query', 'weforms' ), |
| 96 |
'schedule_form' => 'false', |
| 97 |
'schedule_start' => '', |
| 98 |
'schedule_end' => '', |
| 99 |
'sc_pending_message' => __( 'Form submission hasn\'t been started yet', 'weforms' ), |
| 100 |
'sc_expired_message' => __( 'Form submission is now closed.', 'weforms' ), |
| 101 |
'require_login' => 'false', |
| 102 |
'req_login_message' => __( 'You need to login to submit a query.', 'weforms' ), |
| 103 |
'limit_entries' => 'false', |
| 104 |
'limit_number' => '100', |
| 105 |
'limit_message' => __( 'Sorry, we have reached the maximum number of submissions.', 'weforms' ), |
| 106 |
'label_position' => 'above', |
| 107 |
); |
| 108 |
} |
| 109 |
|
| 110 |
/** |
| 111 |
* Get notifications of contact form template |
| 112 |
* |
| 113 |
* @since 1.0.0-beta.3 |
| 114 |
* |
| 115 |
* @return array |
| 116 |
*/ |
| 117 |
function weforms_get_contactform_template_notification() { |
| 118 |
return array( |
| 119 |
array( |
| 120 |
'active' => 'true', |
| 121 |
'name' => __( 'Admin Notification', 'weforms' ), |
| 122 |
'subject' => '[{form_name}] ' . __( 'New Form Submission', 'weforms' ) . ' #{entry_id}', |
| 123 |
'to' => '{admin_email}', |
| 124 |
'replyTo' => '{field:email}', |
| 125 |
'message' => '{all_fields}', |
| 126 |
'fromName' => '{site_name}', |
| 127 |
'fromAddress' => '{admin_email}', |
| 128 |
'cc' => '', |
| 129 |
'bcc' => '', |
| 130 |
), |
| 131 |
); |
| 132 |
} |
| 133 |
|