← All changes
|
includes/templates/class-template-donation-form.php
+85
-83
1.6.9
→
1.3.9
View file →
| @@ -1,83 +1,85 @@ | ||
| 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 | -} | |
| 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 = true; | |
| 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 = array( | |
| 26 | + array_merge( $all_fields['name_field']->get_field_props(), array( | |
| 27 | + 'required' => 'yes', | |
| 28 | + 'format' => 'first-last', | |
| 29 | + | |
| 30 | + 'first_name' => array( | |
| 31 | + 'placeholder' => '', | |
| 32 | + 'default' => '', | |
| 33 | + 'sub' => __( 'First Name', 'weforms' ) | |
| 34 | + ), | |
| 35 | + 'last_name' => array( | |
| 36 | + 'placeholder' => '', | |
| 37 | + 'default' => '', | |
| 38 | + 'sub' => __( 'Last Name', 'weforms' ) | |
| 39 | + ), | |
| 40 | + 'hide_subs' => false, | |
| 41 | + 'name' => 'format', | |
| 42 | + ) ), | |
| 43 | + array_merge( $all_fields['email_address']->get_field_props(), array( | |
| 44 | + 'required' => 'yes', | |
| 45 | + 'label' => 'Email Address', | |
| 46 | + 'name' => 'email_address', | |
| 47 | + ) ), | |
| 48 | + array_merge( $all_fields['numeric_text_field']->get_field_props(), array( | |
| 49 | + 'label' => 'Phone Number', | |
| 50 | + 'name' => 'phone_number', | |
| 51 | + ) ), | |
| 52 | + array_merge( $all_fields['radio_field']->get_field_props(), array( | |
| 53 | + 'required' => 'yes', | |
| 54 | + 'label' => 'Type Of Donation', | |
| 55 | + 'name' => 'type_of_donation', | |
| 56 | + 'options' => array( | |
| 57 | + 'donation_1' => __( 'Donation-1', 'weforms' ), | |
| 58 | + 'donation_2' => __( 'Donation-2', 'weforms' ), | |
| 59 | + 'donation_3' => __( 'Donation-3', 'weforms' ), | |
| 60 | + ), | |
| 61 | + ) ), | |
| 62 | + array_merge( $all_fields['single_product']->get_field_props(), array( | |
| 63 | + 'required' => 'yes', | |
| 64 | + 'label' => __('Donation Amount', 'weforms'), | |
| 65 | + 'name' => 'price', | |
| 66 | + 'price' => array( | |
| 67 | + 'price' => 10, | |
| 68 | + 'type' => 'donation', | |
| 69 | + ), | |
| 70 | + ) ), | |
| 71 | + array_merge( $all_fields['payment_method']->get_field_props(), array( | |
| 72 | + 'required' => 'yes', | |
| 73 | + 'label' => __('Payment Method', 'weforms'), | |
| 74 | + 'name' => 'payment_method', | |
| 75 | + ) ), | |
| 76 | + array_merge( $all_fields['textarea_field']->get_field_props(), array( | |
| 77 | + 'label' => 'Comments', | |
| 78 | + 'name' => 'comments' | |
| 79 | + ) ), | |
| 80 | + ); | |
| 81 | + | |
| 82 | + return $form_fields; | |
| 83 | + } | |
| 84 | + | |
| 85 | +} | |