| 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 |
$is_required = isset( $field[ 'required' ] ) ? $field[ 'required' ] : false; |
| 18 |
$value = isset( $field[ 'value' ] ) ? $field[ 'value' ] : ''; |
| 19 |
|
| 20 |
/* Set the default pattern */ |
| 21 |
if ( ! isset( $field[ 'attrs' ][ 'pattern' ] ) ) { |
| 22 |
$field[ 'attrs' ][ 'pattern' ] = 'https?://.+'; |
| 23 |
} |
| 24 |
|
| 25 |
/* Set the default onblur attribute */ |
| 26 |
if ( ! isset( $field[ 'attrs' ][ 'onblur' ] ) ) { |
| 27 |
$field[ 'attrs' ][ 'onblur' ] = 'CHARITABLE.SanitizeURL(this)'; |
| 28 |
} |
| 29 |
|
| 30 |
?> |
| 31 |
<div id="charitable_field_<?php echo $field['key'] ?>" class="<?php echo $classes ?>"> |
| 32 |
<?php if ( isset( $field['label'] ) ) : ?> |
| 33 |
<label for="charitable_field_<?php echo $field['key'] ?>"> |
| 34 |
<?php echo $field['label'] ?> |
| 35 |
<?php if ( $is_required ) : ?> |
| 36 |
<abbr class="required" title="required">*</abbr> |
| 37 |
<?php endif ?> |
| 38 |
</label> |
| 39 |
<?php endif ?> |
| 40 |
<input type="url" name="<?php echo $field[ 'key' ] ?>" value="<?php echo esc_attr( stripslashes( $value ) ) ?>" <?php echo charitable_get_arbitrary_attributes( $field ) ?>/> |
| 41 |
</div> |