PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.17
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.17
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
weforms / includes / fields / class-field-html.php

class-field-html.php in weForms – Easy Drag & Drop Contact Form Builder For WordPress 1.6.17, at includes/fields/class-field-html.php

97 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Text Field Class
5 */
6 class WeForms_Form_Field_HTML extends WeForms_Field_Contract {
7
8 public 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 int $form_id
19 *
20 * @return void
21 */
22 public function render( $field_settings, $form_id ) {
23 /**
24 * Ensure the field name is set. There have been cases where the name array key is not set.
25 * Not sure why and we were unable to replicate without manually removing the key.
26 * This is a failsafe to ensure the field name is set.
27 */
28 if ( ! isset( $field_settings['name'] ) ) {
29 $field_settings['name'] = 'custom_html';
30 }
31 $use_theme_css = isset( $form_settings['use_theme_css'] ) ? $form_settings['use_theme_css'] : 'wpuf-style';
32 ?>
33 <li <?php $this->print_list_attributes( $field_settings ); ?>>
34 <div class="wpuf-fields <?php echo 'html_' . esc_attr( $form_id ); ?><?php echo ' wpuf_'. esc_attr( $field_settings['name'] ).'_'. esc_attr( $form_id ); ?>" data-style="<?php echo esc_attr( $use_theme_css ); ?>">
35 <?php echo $field_settings['html']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
36 </div>
37
38 </li>
39 <?php
40 }
41
42 /**
43 * It's a full width block
44 *
45 * @return bool
46 */
47 public function is_full_width() {
48 return true;
49 }
50
51 /**
52 * Get field options setting
53 *
54 * @return array
55 */
56 public function get_options_settings() {
57 $settings = [
58 [
59 'name' => 'html',
60 'title' => __( 'Html Codes', 'weforms' ),
61 'type' => 'textarea',
62 'section' => 'basic',
63 'priority' => 11,
64 'help_text' => __( 'Paste your HTML codes, WordPress shortcodes will also work here', 'weforms' ),
65 ],
66 [
67 'name' => 'name',
68 'title' => __( 'Meta Key', 'weforms' ),
69 'type' => 'text-meta',
70 'section' => 'basic',
71 'priority' => 12,
72 'help_text' => __( 'Name of the meta key this field will save to', 'weforms' ),
73 ],
74 ];
75
76 return $settings;
77 }
78
79 /**
80 * Get the field props
81 *
82 * @return array
83 */
84 public function get_field_props() {
85 $props = [
86 'template' => $this->get_type(),
87 'label' => $this->get_name(),
88 'html' => sprintf( '%s', __( 'HTML Section', 'weforms' ) ),
89 'id' => 0,
90 'is_new' => true,
91 'wpuf_cond' => $this->default_conditional_prop(),
92 ];
93
94 return $props;
95 }
96 }
97