| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Text Field Class |
| 5 |
*/ |
| 6 |
class WeForms_Form_Field_HTML extends WeForms_Field_Contract { |
| 7 |
|
| 8 |
function __construct() { |
| 9 |
$this->name = __( 'Custom HTML', 'weforms' ); |
| 10 |
$this->input_type = 'custom_html'; |
| 11 |
$this->icon = 'code'; |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* Render the text field |
| 16 |
* |
| 17 |
* @param array $field_settings |
| 18 |
* @param integer $form_id |
| 19 |
* |
| 20 |
* @return void |
| 21 |
*/ |
| 22 |
public function render( $field_settings, $form_id ) { |
| 23 |
?> |
| 24 |
<li <?php $this->print_list_attributes( $field_settings ); ?>> |
| 25 |
|
| 26 |
<div class="wpuf-fields <?php echo 'html_' . $form_id; ?><?php echo ' wpuf_'.$field_settings['name'].'_'.$form_id; ?>"> |
| 27 |
<?php echo $field_settings['html']; ?> |
| 28 |
</div> |
| 29 |
|
| 30 |
</li> |
| 31 |
<?php |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* It's a full width block |
| 36 |
* |
| 37 |
* @return boolean |
| 38 |
*/ |
| 39 |
public function is_full_width() { |
| 40 |
return true; |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Get field options setting |
| 45 |
* |
| 46 |
* @return array |
| 47 |
*/ |
| 48 |
public function get_options_settings() { |
| 49 |
$settings = array( |
| 50 |
array( |
| 51 |
'name' => 'html', |
| 52 |
'title' => __( 'HTML Codes', 'wpuf' ), |
| 53 |
'type' => 'textarea', |
| 54 |
'section' => 'basic', |
| 55 |
'priority' => 11, |
| 56 |
'help_text' => __( 'Paste your HTML codes, WordPress shortcodes will also work here', 'wpuf' ), |
| 57 |
), |
| 58 |
); |
| 59 |
|
| 60 |
return $settings; |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* Get the field props |
| 65 |
* |
| 66 |
* @return array |
| 67 |
*/ |
| 68 |
public function get_field_props() { |
| 69 |
$props = array( |
| 70 |
'template' => $this->get_type(), |
| 71 |
'html' => sprintf( '<p>%s</p>', __( 'Some description about this section', 'wpuf' ) ), |
| 72 |
'id' => 0, |
| 73 |
'is_new' => true, |
| 74 |
'wpuf_cond' => $this->default_conditional_prop() |
| 75 |
); |
| 76 |
|
| 77 |
return $props; |
| 78 |
} |
| 79 |
} |