BP_XProfile_Field_Type_Datebox::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

(array) (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-datebox.php

	public function edit_field_html( array $raw_properties = array() ) {

		// User_id is a special optional parameter that we pass to.
		// {@link bp_the_profile_field_options()}.
		if ( isset( $raw_properties['user_id'] ) ) {
			$user_id = (int) $raw_properties['user_id'];
			unset( $raw_properties['user_id'] );
		} else {
			$user_id = bp_displayed_user_id();
		}

		$day_r = bp_parse_args( $raw_properties, array(
			'id'   => bp_get_the_profile_field_input_name() . '_day',
			'name' => bp_get_the_profile_field_input_name() . '_day'
		) );

		$month_r = bp_parse_args( $raw_properties, array(
			'id'   => bp_get_the_profile_field_input_name() . '_month',
			'name' => bp_get_the_profile_field_input_name() . '_month'
		) );

		$year_r = bp_parse_args( $raw_properties, array(
			'id'   => bp_get_the_profile_field_input_name() . '_year',
			'name' => bp_get_the_profile_field_input_name() . '_year'
		) ); ?>

			<legend>
				<?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" tabindex="0"><?php bp_the_profile_field_description(); ?></p>
			<?php endif; ?>

			<div class="input-options datebox-selects">

				<?php

				/**
				 * Fires after field label and displays associated errors for the field.
				 *
				 * This is a dynamic hook that is dependent on the associated
				 * field ID. The hooks will be similar to `bp_field_12_errors`
				 * where the 12 is the field ID. Simply replace the 12 with
				 * your needed target ID.
				 *
				 * @since BuddyPress 1.8.0
				 */
				do_action( bp_get_the_profile_field_errors_action() ); ?>

				<label for="<?php bp_the_profile_field_input_name(); ?>_day" class="xprofile-field-label"><?php
					esc_html_e( 'Day', 'buddyboss' );
				?></label>
				<select <?php echo $this->get_edit_field_html_elements( $day_r ); ?>>
					<?php bp_the_profile_field_options( array(
						'type'    => 'day',
						'user_id' => $user_id
					) ); ?>
				</select>

				<label for="<?php bp_the_profile_field_input_name(); ?>_month" class="xprofile-field-label"><?php
					esc_html_e( 'Month', 'buddyboss' );
				?></label>
				<select <?php echo $this->get_edit_field_html_elements( $month_r ); ?>>
					<?php bp_the_profile_field_options( array(
						'type'    => 'month',
						'user_id' => $user_id
					) ); ?>
				</select>

				<label for="<?php bp_the_profile_field_input_name(); ?>_year" class="xprofile-field-label"><?php
					esc_html_e( 'Year', 'buddyboss' );
				?></label>
				<select <?php echo $this->get_edit_field_html_elements( $year_r ); ?>>
					<?php bp_the_profile_field_options( array(
						'type'    => 'year',
						'user_id' => $user_id
					) ); ?>
				</select>

			</div>

	<?php
	}

Changelog

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