# formidable/5.0.14/classes/models/fields/FrmFieldTextarea.php

Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes &amp; More, version 5.0.14. 71 lines.

- Page: https://pluginprobe.com/plugins/formidable/5.0.14/code/classes/models/fields/FrmFieldTextarea.php
- Raw: https://pluginprobe.com/plugins/formidable/5.0.14/raw/classes/models/fields/FrmFieldTextarea.php
- Modified: 2021-11-17T19:23:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/formidable/5.0.14/code/classes/models/fields/FrmFieldTextarea.php#L10-L20`.

```php
<?php
if ( ! defined( 'ABSPATH' ) ) {
	die( 'You are not allowed to call this page directly.' );
}

/**
 * @since 3.0
 */
class FrmFieldTextarea extends FrmFieldType {

	/**
	 * @var string
	 * @since 3.0
	 */
	protected $type = 'textarea';

	protected function field_settings_for_type() {
		return array(
			'size'           => true,
			'clear_on_focus' => true,
		);
	}

	protected function extra_field_opts() {
		return array(
			'max' => '5',
		);
	}

	/**
	 * @param string $name
	 */
	public function show_on_form_builder( $name = '' ) {
		$size      = FrmField::get_option( $this->field, 'size' );
		$size_html = $size ? ' style="width:' . esc_attr( $size . ( is_numeric( $size ) ? 'px' : '' ) ) . '";' : '';

		$max           = FrmField::get_option( $this->field, 'max' );
		$default_value = FrmAppHelper::esc_textarea( force_balance_tags( $this->get_field_column( 'default_value' ) ) );

		echo '<textarea name="' . esc_attr( $this->html_name( $name ) ) . '" ' . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
			$size_html // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
			. ' rows="' . esc_attr( $max ) . '" ' .
			'id="' . esc_attr( $this->html_id() ) . '" class="dyn_default_value">' .
			$default_value // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
			. '</textarea>';
	}

	protected function prepare_display_value( $value, $atts ) {
		FrmFieldsHelper::run_wpautop( $atts, $value );

		return $value;
	}

	/**
	 * @param array $args
	 * @param array $shortcode_atts
	 *
	 * @return string
	 */
	public function front_field_input( $args, $shortcode_atts ) {
		$input_html = $this->get_field_input_html_hook( $this->field );
		$this->add_aria_description( $args, $input_html );
		$rows = ( $this->field['max'] ) ? 'rows="' . esc_attr( $this->field['max'] ) . '" ' : '';

		return '<textarea name="' . esc_attr( $args['field_name'] ) . '" id="' . esc_attr( $args['html_id'] ) . '" ' .
			$rows . $input_html . '>' .
			FrmAppHelper::esc_textarea( $this->field['value'] ) .
			'</textarea>';
	}
}

```
