action-button.php
3 years ago
calculated-field.php
3 years ago
checkbox-field.php
3 years ago
color-picker-field.php
3 years ago
date-field.php
3 years ago
datetime-field.php
3 years ago
form-break-field.php
3 years ago
group-break-field.php
3 years ago
heading-field.php
3 years ago
hidden-field.php
3 years ago
image-preview.php
3 years ago
map-field.php
3 years ago
media-field.php
3 years ago
number-field.php
3 years ago
preset-media-field.php
3 years ago
progress-bar.php
3 years ago
radio-field.php
3 years ago
range-field.php
3 years ago
select-field.php
3 years ago
text-field.php
3 years ago
textarea-field.php
3 years ago
time-field.php
3 years ago
wysiwyg-field.php
3 years ago
textarea-field.php
40 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Textarea template |
| 4 | * |
| 5 | * @var \Jet_Form_Builder\Blocks\Render\Base $this |
| 6 | */ |
| 7 | |
| 8 | use Jet_Form_Builder\Blocks\Dynamic_Value; |
| 9 | use Jet_Form_Builder\Classes\Regexp_Tools; |
| 10 | |
| 11 | $this->add_attribute( 'class', 'jet-form-builder__field textarea-field' ); |
| 12 | $this->add_attribute( 'class', $args['class_name'] ); |
| 13 | $this->add_attribute( 'placeholder', $args['placeholder'] ); |
| 14 | $this->add_attribute( 'required', $this->block_type->get_required_val( $args ) ); |
| 15 | $this->add_attribute( 'name', $this->block_type->get_field_name( $args['name'] ) ); |
| 16 | $this->add_attribute( 'data-field-name', $args['name'] ); |
| 17 | $this->add_attribute( 'id', $this->block_type->get_field_id( $args ) ); |
| 18 | $this->add_attribute( 'data-jfb-sync' ); |
| 19 | |
| 20 | if ( Regexp_Tools::has_macro( $this->args['default'] ) ) { |
| 21 | wp_enqueue_script( Dynamic_Value::HANDLE ); |
| 22 | |
| 23 | $this->add_attribute( 'data-value', $this->args['default'] ); |
| 24 | } |
| 25 | |
| 26 | if ( ! empty( $args['minlength'] ) ) { |
| 27 | $this->add_attribute( 'minlength', $args['minlength'] ); |
| 28 | } |
| 29 | |
| 30 | if ( ! empty( $args['maxlength'] ) ) { |
| 31 | $this->add_attribute( 'maxlength', $args['maxlength'] ); |
| 32 | } |
| 33 | |
| 34 | // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped |
| 35 | ?> |
| 36 | <div class="jet-form-builder__field-wrap"> |
| 37 | <textarea <?php $this->render_attributes_string(); ?>><?php echo $this->has_attribute( 'data-value' ) ? '' : esc_textarea( $args['default'] ); ?></textarea> |
| 38 | </div> |
| 39 | <?php // phpcs:enable WordPress.Security.EscapeOutput.OutputNotEscaped ?> |
| 40 |