| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Contact form template |
| 5 |
*/ |
| 6 |
class WeForms_Template_Contact extends WeForms_Form_Template { |
| 7 |
|
| 8 |
public function __construct() { |
| 9 |
parent::__construct(); |
| 10 |
|
| 11 |
$this->enabled = true; |
| 12 |
$this->title = __( 'Contact Form', 'weforms' ); |
| 13 |
$this->description = __( 'Create a simple contact form for your site.', 'weforms' ); |
| 14 |
$this->image = WEFORMS_ASSET_URI . '/images/form-template/contact.png'; |
| 15 |
$this->category = 'default'; |
| 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['textarea_field']->get_field_props(), [ |
| 36 |
'required' => 'yes', |
| 37 |
'label' => __( 'Message', 'weforms' ), |
| 38 |
'name' => 'message', |
| 39 |
] ), |
| 40 |
]; |
| 41 |
|
| 42 |
return $form_fields; |
| 43 |
} |
| 44 |
} |
| 45 |
|