PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 4.06.03
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v4.06.03
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / classes / models / fields / FrmFieldTextarea.php

FrmFieldTextarea.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 4.06.03, at classes/models/fields/FrmFieldTextarea.php

68 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * @since 3.0
5 */
6 class FrmFieldTextarea extends FrmFieldType {
7
8 /**
9 * @var string
10 * @since 3.0
11 */
12 protected $type = 'textarea';
13
14 protected function field_settings_for_type() {
15 return array(
16 'size' => true,
17 'clear_on_focus' => true,
18 );
19 }
20
21 protected function extra_field_opts() {
22 return array(
23 'max' => '5',
24 );
25 }
26
27 /**
28 * @param string $name
29 */
30 public function show_on_form_builder( $name = '' ) {
31 $size = FrmField::get_option( $this->field, 'size' );
32 $size_html = $size ? ' style="width:' . esc_attr( $size . ( is_numeric( $size ) ? 'px' : '' ) ) . '";' : '';
33
34 $max = FrmField::get_option( $this->field, 'max' );
35 $default_value = FrmAppHelper::esc_textarea( force_balance_tags( $this->get_field_column( 'default_value' ) ) );
36
37 echo '<textarea name="' . esc_attr( $this->html_name( $name ) ) . '" ' . // WPCS: XSS ok.
38 $size_html // WPCS: XSS ok.
39 . ' rows="' . esc_attr( $max ) . '" ' .
40 'id="' . esc_attr( $this->html_id() ) . '" class="dyn_default_value">' .
41 $default_value // WPCS: XSS ok.
42 . '</textarea>';
43 }
44
45 protected function prepare_display_value( $value, $atts ) {
46 FrmFieldsHelper::run_wpautop( $atts, $value );
47
48 return $value;
49 }
50
51 /**
52 * @param array $args
53 * @param array $shortcode_atts
54 *
55 * @return string
56 */
57 public function front_field_input( $args, $shortcode_atts ) {
58 $input_html = $this->get_field_input_html_hook( $this->field );
59 $this->add_aria_description( $args, $input_html );
60 $rows = ( $this->field['max'] ) ? 'rows="' . esc_attr( $this->field['max'] ) . '" ' : '';
61
62 return '<textarea name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" ' .
63 $rows . $input_html . '>' .
64 FrmAppHelper::esc_textarea( $this->field['value'] ) .
65 '</textarea>';
66 }
67 }
68