← All changes
|
includes/templates/class-template-polling-form.php
+52
-51
1.6.21
→
1.4.0
View file →
| @@ -1,51 +1,52 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * A simple contact form for sending message | |
| 4 | - */ | |
| 5 | -class WeForms_Template_Polling_Form extends WeForms_Form_Template { | |
| 6 | - | |
| 7 | - public function __construct() { | |
| 8 | - parent::__construct(); | |
| 9 | - | |
| 10 | - $this->enabled = class_exists( 'WeForms_Pro' ); | |
| 11 | - $this->title = __( 'Polling Form', 'weforms' ); | |
| 12 | - $this->description = ''; | |
| 13 | - $this->category = 'default'; | |
| 14 | - $this->image = WEFORMS_ASSET_URI . '/images/form-template/polling_form.png'; | |
| 15 | - $this->category = 'feedback'; | |
| 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['radio_field']->get_field_props(), [ | |
| 28 | - 'required' => 'yes', | |
| 29 | - 'label' => 'Poll Question', | |
| 30 | - 'name' => 'poll_field', | |
| 31 | - ] ), | |
| 32 | - ]; | |
| 33 | - | |
| 34 | - return $form_fields; | |
| 35 | - } | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * Get the form settings | |
| 39 | - * | |
| 40 | - * @return array | |
| 41 | - */ | |
| 42 | - public function get_form_settings() { | |
| 43 | - $defaults = $this->get_default_settings(); | |
| 44 | - | |
| 45 | - return array_merge( $defaults, [ | |
| 46 | - 'message' => __( 'Thanks for taking part in the poll!', 'weforms' ), | |
| 47 | - 'submit_text' => __( 'Submit', 'weforms' ), | |
| 48 | - 'label_position' => 'left', | |
| 49 | - ] ); | |
| 50 | - } | |
| 51 | -} | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * A simple contact form for sending message | |
| 4 | + */ | |
| 5 | +class WeForms_Template_Polling_Form extends WeForms_Form_Template { | |
| 6 | + | |
| 7 | + public function __construct() { | |
| 8 | + parent::__construct(); | |
| 9 | + | |
| 10 | + $this->enabled = class_exists( 'WeForms_Pro' ); | |
| 11 | + $this->title = __( 'Polling Form', 'weforms' ); | |
| 12 | + $this->description = ''; | |
| 13 | + $this->category = 'default'; | |
| 14 | + $this->image = WEFORMS_ASSET_URI . '/images/form-template/polling_form.png'; | |
| 15 | + $this->category = 'feedback'; | |
| 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['radio_field']->get_field_props(), array( | |
| 28 | + 'required' => 'yes', | |
| 29 | + 'label' => 'Poll Question', | |
| 30 | + 'name' => 'poll_field', | |
| 31 | + ) ), | |
| 32 | + ); | |
| 33 | + | |
| 34 | + return $form_fields; | |
| 35 | + } | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Get the form settings | |
| 39 | + * | |
| 40 | + * @return array | |
| 41 | + */ | |
| 42 | + public function get_form_settings() { | |
| 43 | + $defaults = $this->get_default_settings(); | |
| 44 | + | |
| 45 | + return array_merge( $defaults, array( | |
| 46 | + 'message' => __( 'Thanks for taking part in the poll!', 'weforms' ), | |
| 47 | + 'submit_text' => __( 'Submit', 'weforms' ), | |
| 48 | + 'label_position' => 'left', | |
| 49 | + ) ); | |
| 50 | + } | |
| 51 | + | |
| 52 | +} | |