| @@ -1,88 +1,87 @@ | ||
| 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 | - $use_theme_css = isset( $form_settings['use_theme_css'] ) ? $form_settings['use_theme_css'] : 'wpuf-style'; | |
| 24 | - ?> | |
| 25 | - <li <?php $this->print_list_attributes( $field_settings ); ?>> | |
| 26 | - <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 ); ?>"> | |
| 27 | - <?php echo $field_settings['html']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?> | |
| 28 | - </div> | |
| 29 | - | |
| 30 | - </li> | |
| 31 | - <?php | |
| 32 | - } | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * It's a full width block | |
| 36 | - * | |
| 37 | - * @return bool | |
| 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 = [ | |
| 50 | - [ | |
| 51 | - 'name' => 'html', | |
| 52 | - 'title' => __( 'Html Codes', 'weforms' ), | |
| 53 | - 'type' => 'textarea', | |
| 54 | - 'section' => 'basic', | |
| 55 | - 'priority' => 11, | |
| 56 | - 'help_text' => __( 'Paste your HTML codes, WordPress shortcodes will also work here', 'weforms' ), | |
| 57 | - ], | |
| 58 | - [ | |
| 59 | - 'name' => 'name', | |
| 60 | - 'title' => __( 'Meta Key', 'weforms' ), | |
| 61 | - 'type' => 'text-meta', | |
| 62 | - 'section' => 'basic', | |
| 63 | - 'priority' => 12, | |
| 64 | - 'help_text' => __( 'Name of the meta key this field will save to', 'weforms' ), | |
| 65 | - ], | |
| 66 | - ]; | |
| 67 | - | |
| 68 | - return $settings; | |
| 69 | - } | |
| 70 | - | |
| 71 | - /** | |
| 72 | - * Get the field props | |
| 73 | - * | |
| 74 | - * @return array | |
| 75 | - */ | |
| 76 | - public function get_field_props() { | |
| 77 | - $props = [ | |
| 78 | - 'template' => $this->get_type(), | |
| 79 | - 'label' => $this->get_name(), | |
| 80 | - 'html' => sprintf( '%s', __( 'HTML Section', 'weforms' ) ), | |
| 81 | - 'id' => 0, | |
| 82 | - 'is_new' => true, | |
| 83 | - 'wpuf_cond' => $this->default_conditional_prop(), | |
| 84 | - ]; | |
| 85 | - | |
| 86 | - return $props; | |
| 87 | - } | |
| 88 | -} | |
| 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 | + <li <?php $this->print_list_attributes( $field_settings ); ?>> | |
| 25 | + <div class="wpuf-fields <?php echo 'html_' . esc_attr( $form_id ); ?><?php echo ' wpuf_'. esc_attr( $field_settings['name'] ).'_'. esc_attr( $form_id ); ?>"> | |
| 26 | + <?php echo $field_settings['html']; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?> | |
| 27 | + </div> | |
| 28 | + | |
| 29 | + </li> | |
| 30 | + <?php | |
| 31 | + } | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * It's a full width block | |
| 35 | + * | |
| 36 | + * @return bool | |
| 37 | + */ | |
| 38 | + public function is_full_width() { | |
| 39 | + return true; | |
| 40 | + } | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * Get field options setting | |
| 44 | + * | |
| 45 | + * @return array | |
| 46 | + */ | |
| 47 | + public function get_options_settings() { | |
| 48 | + $settings = [ | |
| 49 | + [ | |
| 50 | + 'name' => 'html', | |
| 51 | + 'title' => __( 'Html Codes', 'weforms' ), | |
| 52 | + 'type' => 'textarea', | |
| 53 | + 'section' => 'basic', | |
| 54 | + 'priority' => 11, | |
| 55 | + 'help_text' => __( 'Paste your HTML codes, WordPress shortcodes will also work here', 'weforms' ), | |
| 56 | + ], | |
| 57 | + [ | |
| 58 | + 'name' => 'name', | |
| 59 | + 'title' => __( 'Meta Key', 'weforms' ), | |
| 60 | + 'type' => 'text-meta', | |
| 61 | + 'section' => 'basic', | |
| 62 | + 'priority' => 12, | |
| 63 | + 'help_text' => __( 'Name of the meta key this field will save to', 'weforms' ), | |
| 64 | + ], | |
| 65 | + ]; | |
| 66 | + | |
| 67 | + return $settings; | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * Get the field props | |
| 72 | + * | |
| 73 | + * @return array | |
| 74 | + */ | |
| 75 | + public function get_field_props() { | |
| 76 | + $props = [ | |
| 77 | + 'template' => $this->get_type(), | |
| 78 | + 'label' => $this->get_name(), | |
| 79 | + 'html' => sprintf( '%s', __( 'HTML Section', 'weforms' ) ), | |
| 80 | + 'id' => 0, | |
| 81 | + 'is_new' => true, | |
| 82 | + 'wpuf_cond' => $this->default_conditional_prop(), | |
| 83 | + ]; | |
| 84 | + | |
| 85 | + return $props; | |
| 86 | + } | |
| 87 | +} | |