| 1 |
<?php |
| 2 |
/** |
| 3 |
* Blank form template |
| 4 |
*/ |
| 5 |
class Weforms_Donation_Form extends WeForms_Form_Template { |
| 6 |
|
| 7 |
public function __construct() { |
| 8 |
parent::__construct(); |
| 9 |
|
| 10 |
$this->enabled = class_exists( 'WeForms_Pro' ); |
| 11 |
$this->title = __( 'Donation Form', 'weforms' ); |
| 12 |
$this->description = __( 'Inspire people to donate more on your site with this form', 'weforms' ); |
| 13 |
$this->image = WEFORMS_ASSET_URI . '/images/form-template/donation-form.png'; |
| 14 |
$this->category = 'payment'; |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Get the form fields |
| 19 |
* |
| 20 |
* @return array |
| 21 |
*/ |
| 22 |
public function get_form_fields() { |
| 23 |
$all_fields = $this->get_available_fields(); |
| 24 |
|
| 25 |
$form_fields = [ |
| 26 |
array_merge( $all_fields['name_field']->get_field_props(), [ |
| 27 |
'required' => 'yes', |
| 28 |
'format' => 'first-last', |
| 29 |
'first_name' => [ |
| 30 |
'placeholder' => '', |
| 31 |
'default' => '', |
| 32 |
'sub' => __( 'First Name', 'weforms' ), |
| 33 |
], |
| 34 |
'last_name' => [ |
| 35 |
'placeholder' => '', |
| 36 |
'default' => '', |
| 37 |
'sub' => __( 'Last Name', 'weforms' ), |
| 38 |
], |
| 39 |
'hide_subs' => false, |
| 40 |
'name' => 'format', |
| 41 |
] ), |
| 42 |
array_merge( $all_fields['email_address']->get_field_props(), [ |
| 43 |
'required' => 'yes', |
| 44 |
'label' => 'Email Address', |
| 45 |
'name' => 'email_address', |
| 46 |
] ), |
| 47 |
array_merge( $all_fields['numeric_text_field']->get_field_props(), [ |
| 48 |
'label' => 'Phone Number', |
| 49 |
'name' => 'phone_number', |
| 50 |
] ), |
| 51 |
array_merge( $all_fields['radio_field']->get_field_props(), [ |
| 52 |
'required' => 'yes', |
| 53 |
'label' => 'Type Of Donation', |
| 54 |
'name' => 'type_of_donation', |
| 55 |
'options' => [ |
| 56 |
'donation_1' => __( 'Donation-1', 'weforms' ), |
| 57 |
'donation_2' => __( 'Donation-2', 'weforms' ), |
| 58 |
'donation_3' => __( 'Donation-3', 'weforms' ), |
| 59 |
], |
| 60 |
] ), |
| 61 |
array_merge( $all_fields['single_product']->get_field_props(), [ |
| 62 |
'required' => 'yes', |
| 63 |
'label' => __( 'Donation Amount', 'weforms' ), |
| 64 |
'name' => 'price', |
| 65 |
'price' => [ |
| 66 |
'price' => 10, |
| 67 |
'type' => 'donation', |
| 68 |
], |
| 69 |
] ), |
| 70 |
array_merge( $all_fields['payment_method']->get_field_props(), [ |
| 71 |
'required' => 'yes', |
| 72 |
'label' => __( 'Payment Method', 'weforms' ), |
| 73 |
'name' => 'payment_method', |
| 74 |
] ), |
| 75 |
array_merge( $all_fields['textarea_field']->get_field_props(), [ |
| 76 |
'label' => 'Comments', |
| 77 |
'name' => 'comments', |
| 78 |
] ), |
| 79 |
]; |
| 80 |
|
| 81 |
return $form_fields; |
| 82 |
} |
| 83 |
} |
| 84 |
|