| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template used to display text form fields. |
| 4 |
* |
| 5 |
* @author Studio 164a |
| 6 |
* @since 1.0.0 |
| 7 |
* @version 1.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! isset( $view_args[ 'form' ] ) || ! isset( $view_args[ 'field' ] ) ) { |
| 11 |
return; |
| 12 |
} |
| 13 |
|
| 14 |
$form = $view_args[ 'form' ]; |
| 15 |
$field = $view_args[ 'field' ]; |
| 16 |
$classes = esc_attr( $view_args[ 'classes' ] ); |
| 17 |
$field_type = isset( $field[ 'type' ] ) ? $field[ 'type' ] : 'text'; |
| 18 |
$is_required = isset( $field[ 'required' ] ) ? $field[ 'required' ] : false; |
| 19 |
$value = isset( $field[ 'value' ] ) ? $field[ 'value' ] : ''; |
| 20 |
$placeholder = isset( $field[ 'placeholder' ] ) ? esc_attr( $field[ 'placeholder' ] ) : ''; |
| 21 |
$pattern = isset( $field[ 'pattern' ] ) ? 'pattern="' . esc_attr( $field[ 'pattern' ] ) . '"' : ' '; |
| 22 |
?> |
| 23 |
<div id="charitable_field_<?php echo $field['key'] ?>" class="<?php echo $classes ?>"> |
| 24 |
<?php if ( isset( $field['label'] ) ) : ?> |
| 25 |
<label for="charitable_field_<?php echo $field['key'] ?>"> |
| 26 |
<?php echo $field['label'] ?> |
| 27 |
<?php if ( $is_required ) : ?> |
| 28 |
<abbr class="required" title="required">*</abbr> |
| 29 |
<?php endif ?> |
| 30 |
</label> |
| 31 |
<?php endif ?> |
| 32 |
<input type="<?php echo esc_attr( $field_type ) ?>" name="<?php echo $field[ 'key' ] ?>" value="<?php echo esc_attr( stripslashes( $value ) ) ?>" placeholder="<?php echo $placeholder ?>" <?php echo $pattern ?> /> |
| 33 |
</div> |