PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.5
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.5
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 6.5, at classes/models/fields/FrmFieldTextarea.php

101 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 /**
7 * @since 3.0
8 */
9 class FrmFieldTextarea extends FrmFieldType {
10
11 /**
12 * @var string
13 * @since 3.0
14 */
15 protected $type = 'textarea';
16
17 /**
18 * @var bool
19 */
20 protected $array_allowed = false;
21
22 /**
23 * @return bool[]
24 */
25 protected function field_settings_for_type() {
26 return array(
27 'size' => true,
28 'clear_on_focus' => true,
29 );
30 }
31
32 /**
33 * @return array
34 */
35 protected function extra_field_opts() {
36 return array(
37 'max' => '5',
38 );
39 }
40
41 /**
42 * @param string $name
43 *
44 * @return void
45 */
46 public function show_on_form_builder( $name = '' ) {
47 $size = FrmField::get_option( $this->field, 'size' );
48 $max = FrmField::get_option( $this->field, 'max' );
49
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
52 if ( $size ) {
53 if ( is_numeric( $size ) ) {
54 $size .= 'px';
55 }
56 $style = 'width:' . $size . ';';
57 echo ' style="' . esc_attr( $style ) . '"';
58 }
59
60 echo '>';
61 echo FrmAppHelper::esc_textarea( force_balance_tags( $this->get_field_column( 'default_value' ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
62 echo '</textarea>';
63 }
64
65 protected function prepare_display_value( $value, $atts ) {
66 FrmFieldsHelper::run_wpautop( $atts, $value );
67
68 return $value;
69 }
70
71 /**
72 * @since 6.0
73 *
74 * @param array $field
75 * @param string $default_name
76 * @param mixed $default_value
77 *
78 * @return void
79 */
80 public function show_default_value_field( $field, $default_name, $default_value ) {
81 include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/textarea-default-value-field.php';
82 }
83
84 /**
85 * @param array $args
86 * @param array $shortcode_atts
87 *
88 * @return string
89 */
90 public function front_field_input( $args, $shortcode_atts ) {
91 $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'] ) . '" ' : '';
94
95 return '<textarea name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" ' .
96 $rows . $input_html . '>' .
97 FrmAppHelper::esc_textarea( $this->field['value'] ) .
98 '</textarea>';
99 }
100 }
101