| @@ -1,12 +1,20 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 3 | +// Exit if accessed directly. | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 7 | + | |
| 2 | 8 | /** |
| 3 | 9 | * The template used to display textarea fields. |
| 4 | 10 | * |
| 5 | - * @author Studio 164a | |
| 11 | + * @author WP Charitable LLC | |
| 6 | 12 | * @package Charitable/Templates/Form Fields |
| 7 | 13 | * @since 1.0.0 |
| 8 | 14 | * @version 1.0.0 |
| 15 | + * @version 1.8.6.1 Added description output. | |
| 16 | + * @version 1.8.8.6 | |
| 9 | 17 | */ |
| 10 | 18 | |
| 11 | 19 | if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) { |
| 12 | 20 | return; |
| @@ -11,26 +19,34 @@ | ||
| 11 | 19 | if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) { |
| 12 | 20 | return; |
| 13 | 21 | } |
| 14 | 22 | |
| 15 | -$form = $view_args['form']; | |
| 16 | -$field = $view_args['field']; | |
| 17 | -$classes = $view_args['classes']; | |
| 18 | -$is_required = isset( $field['required'] ) ? $field['required'] : false; | |
| 19 | -$value = isset( $field['value'] ) ? $field['value'] : ''; | |
| 23 | +$charitable_form = $view_args['form']; | |
| 24 | +$charitable_field = $view_args['field']; | |
| 25 | +$charitable_classes = $view_args['classes']; | |
| 26 | +$charitable_is_required = isset( $charitable_field['required'] ) ? $charitable_field['required'] : false; | |
| 27 | +$charitable_value = isset( $charitable_field['value'] ) ? $charitable_field['value'] : ''; | |
| 20 | 28 | |
| 21 | -if ( ! isset( $field['attrs']['rows'] ) ) { | |
| 22 | - $field['attrs']['rows'] = 4; | |
| 29 | +if ( ! isset( $charitable_field['attrs']['rows'] ) ) { | |
| 30 | + $charitable_field['attrs']['rows'] = 4; | |
| 23 | 31 | } |
| 24 | 32 | |
| 25 | 33 | ?> |
| 26 | -<div id="charitable_field_<?php echo $field['key'] ?>" class="<?php echo $classes ?>"> | |
| 27 | - <?php if ( isset( $field['label'] ) ) : ?> | |
| 28 | - <label for="charitable_field_<?php echo $field['key'] ?>_element"> | |
| 29 | - <?php echo $field['label'] ?> | |
| 30 | - <?php if ( $is_required ) : ?> | |
| 31 | - <abbr class="required" title="required">*</abbr> | |
| 34 | +<div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>"> | |
| 35 | + <?php if ( isset( $charitable_field['label'] ) ) : ?> | |
| 36 | + <label for="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element"> | |
| 37 | + <?php echo wp_kses_post( $charitable_field['label'] ); ?> | |
| 38 | + <?php if ( $charitable_is_required ) : ?> | |
| 39 | + <abbr class="required" title="<?php esc_html_e( 'Required', 'charitable' ); ?>">*</abbr> | |
| 32 | 40 | <?php endif ?> |
| 33 | 41 | </label> |
| 34 | 42 | <?php endif ?> |
| 35 | - <textarea name="<?php echo esc_attr( $field['key'] ) ?>" id="charitable_field_<?php echo $field['key'] ?>_element" <?php echo charitable_get_arbitrary_attributes( $field ) ?>><?php echo esc_textarea( stripslashes( $value ) ) ?></textarea> | |
| 36 | -</div> | |
| 43 | + <textarea name="<?php echo esc_attr( $charitable_field['key'] ); ?>" id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element" <?php echo charitable_get_arbitrary_attributes( $charitable_field ); // phpcs:ignore ?>><?php echo esc_textarea( stripslashes( $charitable_value ) ); ?></textarea> | |
| 44 | + <?php | |
| 45 | + | |
| 46 | + // If there is a description, add it after the input. | |
| 47 | + if ( isset( $charitable_field['description'] ) && ! empty( $charitable_field['description'] ) ) { | |
| 48 | + echo '<p class="charitable-field-description">' . wp_kses_post( $charitable_field['description'] ) . '</p>'; | |
| 49 | + } | |
| 50 | + | |
| 51 | + ?> | |
| 52 | +</div> | |