| @@ -9,8 +9,9 @@ | ||
| 9 | 9 | class FrmFieldTextarea extends FrmFieldType { |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @var string |
| 13 | + * | |
| 13 | 14 | * @since 3.0 |
| 14 | 15 | */ |
| 15 | 16 | protected $type = 'textarea'; |
| 16 | 17 | |
| @@ -46,14 +47,23 @@ | ||
| 46 | 47 | public function show_on_form_builder( $name = '' ) { |
| 47 | 48 | $size = FrmField::get_option( $this->field, 'size' ); |
| 48 | 49 | $max = FrmField::get_option( $this->field, 'max' ); |
| 49 | 50 | |
| 50 | - echo '<textarea name="' . esc_attr( $this->html_name( $name ) ) . '" rows="' . esc_attr( $max ) . '" id="' . esc_attr( $this->html_id() ) . '" class="dyn_default_value"'; | |
| 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 ); | |
| 51 | 60 | |
| 52 | 61 | if ( $size ) { |
| 53 | 62 | if ( is_numeric( $size ) ) { |
| 54 | 63 | $size .= 'px'; |
| 55 | 64 | } |
| 65 | + | |
| 56 | 66 | $style = 'width:' . $size . ';'; |
| 57 | 67 | echo ' style="' . esc_attr( $style ) . '"'; |
| 58 | 68 | } |
| 59 | 69 | |
| @@ -63,9 +73,8 @@ | ||
| 63 | 73 | } |
| 64 | 74 | |
| 65 | 75 | protected function prepare_display_value( $value, $atts ) { |
| 66 | 76 | FrmFieldsHelper::run_wpautop( $atts, $value ); |
| 67 | - | |
| 68 | 77 | return $value; |
| 69 | 78 | } |
| 70 | 79 | |
| 71 | 80 | /** |
| @@ -88,13 +97,14 @@ | ||
| 88 | 97 | * @return string |
| 89 | 98 | */ |
| 90 | 99 | public function front_field_input( $args, $shortcode_atts ) { |
| 91 | 100 | $input_html = $this->get_field_input_html_hook( $this->field ); |
| 92 | - $this->add_aria_description( $args, $input_html ); | |
| 93 | - $rows = ( $this->field['max'] ) ? 'rows="' . esc_attr( $this->field['max'] ) . '" ' : ''; | |
| 101 | + $rows = $this->field['max'] ? 'rows="' . esc_attr( $this->field['max'] ) . '" ' : ''; | |
| 94 | 102 | |
| 103 | + // phpcs:disable Generic.WhiteSpace.ScopeIndent | |
| 95 | 104 | return '<textarea name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" ' . |
| 96 | 105 | $rows . $input_html . '>' . |
| 97 | 106 | FrmAppHelper::esc_textarea( $this->field['value'] ) . |
| 98 | 107 | '</textarea>'; |
| 108 | + // phpcs:enable Generic.WhiteSpace.ScopeIndent | |
| 99 | 109 | } |
| 100 | 110 | } |