BP_XProfile_Field_Type_Telephone::input_mask_script( BP_XProfile_Field $current_field )
Prints the jquery input mask script
Description
Parameters
- $current_field
-
(Required)
Return
(void)
Source
File: bp-xprofile/classes/class-bp-xprofile-field-type-telephone.php
public function input_mask_script ( BP_XProfile_Field $current_field ) {
$selected_format = bp_xprofile_get_meta( $current_field->id, 'field', 'phone_format', true );
if ( empty( $selected_format ) ) {
$selected_format = 'international';
}
$all_formats = $this->get_phone_formats();
$selected_format_details = isset( $all_formats[ $selected_format ] ) ? $all_formats[ $selected_format ] : array();
if ( isset ( $selected_format_details[ 'mask' ] ) && !empty( $selected_format_details[ 'mask' ] ) ) {
?>
<script type='text/javascript'>
jQuery(document).ready(function($){
jQuery('#field_<?php echo $current_field->id;?>').mask('<?php echo $selected_format_details['mask'];?>').bind('keypress', function(e){if(e.which == 13){jQuery(this).blur();} } );
});
</script>
<?php
echo ob_get_clean();
}
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.