| 1 |
<?php |
| 2 |
/** |
| 3 |
* A simple contact form for sending message |
| 4 |
*/ |
| 5 |
class WeForms_Template_Comment_Rating extends WeForms_Form_Template { |
| 6 |
|
| 7 |
public function __construct() { |
| 8 |
parent::__construct(); |
| 9 |
|
| 10 |
$this->enabled = class_exists( 'WeForms_Pro' ); |
| 11 |
$this->title = __( 'Comment & Rating Form', 'weforms' ); |
| 12 |
$this->description = ''; |
| 13 |
$this->category = 'default'; |
| 14 |
$this->image = WEFORMS_ASSET_URI . '/images/form-template/comment-and-rating.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['ratings']->get_field_props(), array( |
| 28 |
'required' => 'yes', |
| 29 |
'label' => 'Rating', |
| 30 |
'name' => 'rating', |
| 31 |
) ), |
| 32 |
array_merge( $all_fields['textarea_field']->get_field_props(), array( |
| 33 |
'label' => __( 'Comment', 'weforms' ), |
| 34 |
'name' => 'comment', |
| 35 |
) ), |
| 36 |
array_merge( $all_fields['text_field']->get_field_props(), array( |
| 37 |
'required' => 'yes', |
| 38 |
'label' => 'Name', |
| 39 |
'name' => 'name', |
| 40 |
) ), |
| 41 |
); |
| 42 |
|
| 43 |
return $form_fields; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Get the form settings |
| 48 |
* |
| 49 |
* @return array |
| 50 |
*/ |
| 51 |
public function get_form_settings() { |
| 52 |
$defaults = $this->get_default_settings(); |
| 53 |
|
| 54 |
return array_merge( $defaults, array( |
| 55 |
'message' => __( 'Thanks for your rating!', 'weforms' ), |
| 56 |
'submit_text' => __( 'Submit', 'weforms' ), |
| 57 |
'label_position' => 'left', |
| 58 |
) ); |
| 59 |
} |
| 60 |
|
| 61 |
} |
| 62 |
|