BP_XProfile_Field_Type_Telephone::edit_field_html( array $raw_properties = array() )

Output the edit field HTML for this field type.

Description

Must be used inside the bp_profile_fields() template loop.

Parameters

$raw_properties

(Optional) key/value array of permitted attributes that you want to add.

Default value: array()

Source

File: bp-xprofile/classes/class-bp-xprofile-field-type-telephone.php

	public function edit_field_html( array $raw_properties = array() ) {
		/*
		 * User_id is a special optional parameter that certain other fields
		 * types pass to {@link bp_the_profile_field_options()}.
		 */
		if ( isset( $raw_properties['user_id'] ) ) {
			unset( $raw_properties['user_id'] );
		}

        $selected_format = bp_xprofile_get_meta( bp_get_the_profile_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();

        $placeholder = isset ( $selected_format_details[ 'placeholder' ] ) && !empty( $selected_format_details[ 'placeholder' ] ) ? $selected_format_details[ 'placeholder' ] : '';
        $mask = isset ( $selected_format_details[ 'mask' ] ) && !empty( $selected_format_details[ 'mask' ] ) ? $selected_format_details[ 'mask' ] : '';
        
		$r = bp_parse_args( $raw_properties, array(
			'type'  => 'tel',
			'value' => bp_get_the_profile_field_edit_value(),
            'placeholder' => $placeholder,
		) ); ?>

		<legend id="<?php bp_the_profile_field_input_name(); ?>-1">
			<?php bp_the_profile_field_name(); ?>
			<?php if ( bp_is_register_page() ) : ?>
				<?php bp_the_profile_field_optional_label(); ?>
			<?php else: ?>
				<?php bp_the_profile_field_required_label(); ?>
			<?php endif; ?>
		</legend>
        
        <?php if ( bp_get_the_profile_field_description() ) : ?>
			<p class="description" id="<?php bp_the_profile_field_input_name(); ?>-3"><?php bp_the_profile_field_description(); ?></p>
		<?php endif; ?>

		<?php

		/** This action is documented in bp-xprofile/bp-xprofile-classes */
		do_action( bp_get_the_profile_field_errors_action() ); ?>

		<input <?php echo $this->get_edit_field_html_elements( $r ); ?> aria-labelledby="<?php bp_the_profile_field_input_name(); ?>-1" aria-describedby="<?php bp_the_profile_field_input_name(); ?>-3">

        <span class="input_mask_details" data-field_id="<?php echo esc_attr( bp_get_the_profile_field_input_name() );?>" data-val="<?php echo esc_attr( $mask );?>"></span>
            
		<?php
        
	}

Changelog

Changelog
Version Description
BuddyPress 3.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.