| @@ -9,21 +9,12 @@ | ||
| 9 | 9 | class FrmFieldTextarea extends FrmFieldType { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @var string |
| 13 | - * | |
| 14 | 13 | * @since 3.0 |
| 15 | 14 | */ |
| 16 | 15 | protected $type = 'textarea'; |
| 17 | 16 | |
| 18 | - /** | |
| 19 | - * @var bool | |
| 20 | - */ | |
| 21 | - protected $array_allowed = false; | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * @return bool[] | |
| 25 | - */ | |
| 26 | 17 | protected function field_settings_for_type() { |
| 27 | 18 | return array( |
| 28 | 19 | 'size' => true, |
| 29 | 20 | 'clear_on_focus' => true, |
| @@ -29,11 +20,8 @@ | ||
| 29 | 20 | 'clear_on_focus' => true, |
| 30 | 21 | ); |
| 31 | 22 | } |
| 32 | 23 | |
| 33 | - /** | |
| 34 | - * @return array | |
| 35 | - */ | |
| 36 | 24 | protected function extra_field_opts() { |
| 37 | 25 | return array( |
| 38 | 26 | 'max' => '5', |
| 39 | 27 | ); |
| @@ -40,30 +28,19 @@ | ||
| 40 | 28 | } |
| 41 | 29 | |
| 42 | 30 | /** |
| 43 | 31 | * @param string $name |
| 44 | - * | |
| 45 | - * @return void | |
| 46 | 32 | */ |
| 47 | 33 | public function show_on_form_builder( $name = '' ) { |
| 48 | 34 | $size = FrmField::get_option( $this->field, 'size' ); |
| 49 | 35 | $max = FrmField::get_option( $this->field, 'max' ); |
| 50 | 36 | |
| 51 | - $html_atts = array( | |
| 52 | - 'name' => $this->html_name( $name ), | |
| 53 | - 'id' => $this->html_id(), | |
| 54 | - 'rows' => $max, | |
| 55 | - 'class' => 'dyn_default_value', | |
| 56 | - 'placeholder' => FrmField::get_option( $this->field, 'placeholder' ), | |
| 57 | - ); | |
| 58 | - echo '<textarea'; | |
| 59 | - FrmAppHelper::array_to_html_params( $html_atts, true ); | |
| 37 | + echo '<textarea name="' . esc_attr( $this->html_name( $name ) ) . '" rows="' . esc_attr( $max ) . '" id="' . esc_attr( $this->html_id() ) . '" class="dyn_default_value"'; | |
| 60 | 38 | |
| 61 | 39 | if ( $size ) { |
| 62 | 40 | if ( is_numeric( $size ) ) { |
| 63 | 41 | $size .= 'px'; |
| 64 | 42 | } |
| 65 | - | |
| 66 | 43 | $style = 'width:' . $size . ';'; |
| 67 | 44 | echo ' style="' . esc_attr( $style ) . '"'; |
| 68 | 45 | } |
| 69 | 46 | |
| @@ -73,25 +50,13 @@ | ||
| 73 | 50 | } |
| 74 | 51 | |
| 75 | 52 | protected function prepare_display_value( $value, $atts ) { |
| 76 | 53 | FrmFieldsHelper::run_wpautop( $atts, $value ); |
| 54 | + | |
| 77 | 55 | return $value; |
| 78 | 56 | } |
| 79 | 57 | |
| 80 | 58 | /** |
| 81 | - * @since 6.0 | |
| 82 | - * | |
| 83 | - * @param array $field | |
| 84 | - * @param string $default_name | |
| 85 | - * @param mixed $default_value | |
| 86 | - * | |
| 87 | - * @return void | |
| 88 | - */ | |
| 89 | - public function show_default_value_field( $field, $default_name, $default_value ) { | |
| 90 | - include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/textarea-default-value-field.php'; | |
| 91 | - } | |
| 92 | - | |
| 93 | - /** | |
| 94 | 59 | * @param array $args |
| 95 | 60 | * @param array $shortcode_atts |
| 96 | 61 | * |
| 97 | 62 | * @return string |
| @@ -98,14 +63,12 @@ | ||
| 98 | 63 | */ |
| 99 | 64 | public function front_field_input( $args, $shortcode_atts ) { |
| 100 | 65 | $input_html = $this->get_field_input_html_hook( $this->field ); |
| 101 | 66 | $this->add_aria_description( $args, $input_html ); |
| 102 | - $rows = $this->field['max'] ? 'rows="' . esc_attr( $this->field['max'] ) . '" ' : ''; | |
| 67 | + $rows = ( $this->field['max'] ) ? 'rows="' . esc_attr( $this->field['max'] ) . '" ' : ''; | |
| 103 | 68 | |
| 104 | - // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 105 | 69 | return '<textarea name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" ' . |
| 106 | 70 | $rows . $input_html . '>' . |
| 107 | 71 | FrmAppHelper::esc_textarea( $this->field['value'] ) . |
| 108 | 72 | '</textarea>'; |
| 109 | - // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 110 | 73 | } |
| 111 | 74 | } |