← All changes
|
includes/templates/class-template-event-registration.php
+110
-109
1.6.21
→
1.4.0
View file →
| @@ -1,109 +1,110 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -/** | |
| 4 | - * Event registration form template | |
| 5 | - */ | |
| 6 | -class WeForms_Template_Event_Registration extends WeForms_Form_Template { | |
| 7 | - | |
| 8 | - public function __construct() { | |
| 9 | - parent::__construct(); | |
| 10 | - | |
| 11 | - $this->enabled = true; | |
| 12 | - $this->title = __( 'Event Registration', 'weforms' ); | |
| 13 | - $this->description = __( 'Get your visitors to register for an upcoming event quickly with this registration form template.', 'weforms' ); | |
| 14 | - $this->image = WEFORMS_ASSET_URI . '/images/form-template/event.png'; | |
| 15 | - $this->category = 'event'; | |
| 16 | - } | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * Get the form fields | |
| 20 | - * | |
| 21 | - * @return array | |
| 22 | - */ | |
| 23 | - public function get_form_fields() { | |
| 24 | - $all_fields = $this->get_available_fields(); | |
| 25 | - | |
| 26 | - $form_fields = [ | |
| 27 | - array_merge( $all_fields['name_field']->get_field_props(), [ | |
| 28 | - 'required' => 'yes', | |
| 29 | - 'name' => 'name', | |
| 30 | - ] ), | |
| 31 | - array_merge( $all_fields['email_address']->get_field_props(), [ | |
| 32 | - 'required' => 'yes', | |
| 33 | - 'name' => 'email', | |
| 34 | - ] ), | |
| 35 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 36 | - 'required' => 'yes', | |
| 37 | - 'label' => __( 'Phone', 'weforms' ), | |
| 38 | - 'name' => 'phone', | |
| 39 | - ] ), | |
| 40 | - array_merge( $all_fields['text_field']->get_field_props(), [ | |
| 41 | - 'label' => __( 'Company', 'weforms' ), | |
| 42 | - 'name' => 'compnay', | |
| 43 | - ] ), | |
| 44 | - array_merge( $all_fields['website_url']->get_field_props(), [ | |
| 45 | - 'required' => 'no', | |
| 46 | - 'label' => __( 'Website', 'weforms' ), | |
| 47 | - 'name' => 'website', | |
| 48 | - 'placeholder' => 'https://', | |
| 49 | - ] ), | |
| 50 | - array_merge( $all_fields['radio_field']->get_field_props(), [ | |
| 51 | - 'required' => 'yes', | |
| 52 | - 'label' => __( 'Have you attended before?', 'weforms' ), | |
| 53 | - 'name' => 'attended_before', | |
| 54 | - 'inline' => 'no', | |
| 55 | - 'options' => [ | |
| 56 | - 'yes' => __( 'Yes', 'weforms' ), | |
| 57 | - 'no' => __( 'No', 'weforms' ), | |
| 58 | - ], | |
| 59 | - ] ), | |
| 60 | - array_merge( $all_fields['checkbox_field']->get_field_props(), [ | |
| 61 | - 'required' => 'yes', | |
| 62 | - 'label' => __( 'Dietary Requirements', 'weforms' ), | |
| 63 | - 'name' => 'dietary_requirements', | |
| 64 | - 'inline' => 'no', | |
| 65 | - 'options' => [ | |
| 66 | - 'none' => __( 'None', 'weforms' ), | |
| 67 | - 'vegeterian' => __( 'Vegeterian', 'weforms' ), | |
| 68 | - 'vegan' => __( 'Vegan', 'weforms' ), | |
| 69 | - 'lactose-free' => __( 'Lactose-free', 'weforms' ), | |
| 70 | - 'gluten-free' => __( 'Gluten-free', 'weforms' ), | |
| 71 | - 'kosher' => __( 'Kosher', 'weforms' ), | |
| 72 | - 'halal' => __( 'Halal', 'weforms' ), | |
| 73 | - 'allergies-other' => __( 'Allergies/Other', 'weforms' ), | |
| 74 | - ], | |
| 75 | - ] ), | |
| 76 | - array_merge( $all_fields['radio_field']->get_field_props(), [ | |
| 77 | - 'required' => 'yes', | |
| 78 | - 'label' => 'Do you require any special assistance?', | |
| 79 | - 'name' => 'special_assistance', | |
| 80 | - 'inline' => 'no', | |
| 81 | - 'options' => [ | |
| 82 | - 'yes' => __( 'Yes', 'weforms' ), | |
| 83 | - 'no' => __( 'No', 'weforms' ), | |
| 84 | - ], | |
| 85 | - ] ), | |
| 86 | - array_merge( $all_fields['textarea_field']->get_field_props(), [ | |
| 87 | - 'required' => 'no', | |
| 88 | - 'label' => __( 'Comments or Questions', 'weforms' ), | |
| 89 | - 'name' => 'comments', | |
| 90 | - ] ), | |
| 91 | - ]; | |
| 92 | - | |
| 93 | - return $form_fields; | |
| 94 | - } | |
| 95 | - | |
| 96 | - /** | |
| 97 | - * Get the form settings | |
| 98 | - * | |
| 99 | - * @return array | |
| 100 | - */ | |
| 101 | - public function get_form_settings() { | |
| 102 | - $defaults = $this->get_default_settings(); | |
| 103 | - | |
| 104 | - return array_merge( $defaults, [ | |
| 105 | - 'message' => __( 'Thanks for signing up! We will get in touch with you shortly.', 'weforms' ), | |
| 106 | - 'submit_text' => __( 'Register', 'weforms' ), | |
| 107 | - ] ); | |
| 108 | - } | |
| 109 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Event registration form template | |
| 5 | + */ | |
| 6 | +class WeForms_Template_Event_Registration extends WeForms_Form_Template { | |
| 7 | + | |
| 8 | + public function __construct() { | |
| 9 | + parent::__construct(); | |
| 10 | + | |
| 11 | + $this->enabled = true; | |
| 12 | + $this->title = __( 'Event Registration', 'weforms' ); | |
| 13 | + $this->description = __( 'Get your visitors to register for an upcoming event quickly with this registration form template.', 'weforms' ); | |
| 14 | + $this->image = WEFORMS_ASSET_URI . '/images/form-template/event.png'; | |
| 15 | + $this->category = 'event'; | |
| 16 | + } | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * Get the form fields | |
| 20 | + * | |
| 21 | + * @return array | |
| 22 | + */ | |
| 23 | + public function get_form_fields() { | |
| 24 | + $all_fields = $this->get_available_fields(); | |
| 25 | + | |
| 26 | + $form_fields = array( | |
| 27 | + array_merge( $all_fields['name_field']->get_field_props(), array( | |
| 28 | + 'required' => 'yes', | |
| 29 | + 'name' => 'name', | |
| 30 | + ) ), | |
| 31 | + array_merge( $all_fields['email_address']->get_field_props(), array( | |
| 32 | + 'required' => 'yes', | |
| 33 | + 'name' => 'email', | |
| 34 | + ) ), | |
| 35 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 36 | + 'required' => 'yes', | |
| 37 | + 'label' => __( 'Phone', 'weforms' ), | |
| 38 | + 'name' => 'phone', | |
| 39 | + ) ), | |
| 40 | + array_merge( $all_fields['text_field']->get_field_props(), array( | |
| 41 | + 'label' => __( 'Company', 'weforms' ), | |
| 42 | + 'name' => 'compnay', | |
| 43 | + ) ), | |
| 44 | + array_merge( $all_fields['website_url']->get_field_props(), array( | |
| 45 | + 'required' => 'no', | |
| 46 | + 'label' => __( 'Website', 'weforms' ), | |
| 47 | + 'name' => 'website', | |
| 48 | + 'placeholder' => 'https://', | |
| 49 | + ) ), | |
| 50 | + array_merge( $all_fields['radio_field']->get_field_props(), array( | |
| 51 | + 'required' => 'yes', | |
| 52 | + 'label' => __( 'Have you attended before?', 'weforms' ), | |
| 53 | + 'name' => 'attended_before', | |
| 54 | + 'inline' => 'no', | |
| 55 | + 'options' => array( | |
| 56 | + 'yes' => __( 'Yes', 'weforms' ), | |
| 57 | + 'no' => __( 'No', 'weforms' ), | |
| 58 | + ), | |
| 59 | + ) ), | |
| 60 | + array_merge( $all_fields['checkbox_field']->get_field_props(), array( | |
| 61 | + 'required' => 'yes', | |
| 62 | + 'label' => __( 'Dietary Requirements', 'weforms' ), | |
| 63 | + 'name' => 'dietary_requirements', | |
| 64 | + 'inline' => 'no', | |
| 65 | + 'options' => array( | |
| 66 | + 'none' => __( 'None', 'weforms' ), | |
| 67 | + 'vegeterian' => __( 'Vegeterian', 'weforms' ), | |
| 68 | + 'vegan' => __( 'Vegan', 'weforms' ), | |
| 69 | + 'lactose-free' => __( 'Lactose-free', 'weforms' ), | |
| 70 | + 'gluten-free' => __( 'Gluten-free', 'weforms' ), | |
| 71 | + 'kosher' => __( 'Kosher', 'weforms' ), | |
| 72 | + 'halal' => __( 'Halal', 'weforms' ), | |
| 73 | + 'allergies-other' => __( 'Allergies/Other', 'weforms' ), | |
| 74 | + ), | |
| 75 | + ) ), | |
| 76 | + array_merge( $all_fields['radio_field']->get_field_props(), array( | |
| 77 | + 'required' => 'yes', | |
| 78 | + 'label' => 'Do you require any special assistance?', | |
| 79 | + 'name' => 'special_assistance', | |
| 80 | + 'inline' => 'no', | |
| 81 | + 'options' => array( | |
| 82 | + 'yes' => __( 'Yes', 'weforms' ), | |
| 83 | + 'no' => __( 'No', 'weforms' ), | |
| 84 | + ), | |
| 85 | + ) ), | |
| 86 | + array_merge( $all_fields['textarea_field']->get_field_props(), array( | |
| 87 | + 'required' => 'no', | |
| 88 | + 'label' => __( 'Comments or Questions', 'weforms' ), | |
| 89 | + 'name' => 'comments', | |
| 90 | + ) ), | |
| 91 | + ); | |
| 92 | + | |
| 93 | + return $form_fields; | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * Get the form settings | |
| 98 | + * | |
| 99 | + * @return array | |
| 100 | + */ | |
| 101 | + public function get_form_settings() { | |
| 102 | + $defaults = $this->get_default_settings(); | |
| 103 | + | |
| 104 | + return array_merge( $defaults, array( | |
| 105 | + 'message' => __( 'Thanks for signing up! We will get in touch with you shortly.', 'weforms' ), | |
| 106 | + 'submit_text' => __( 'Register', 'weforms' ), | |
| 107 | + ) ); | |
| 108 | + } | |
| 109 | + | |
| 110 | +} | |