BP_REST_XProfile_Fields_Endpoint::get_gender_type_options( BP_XProfile_Field $field, array $request )

Get Gender field options

Description

Parameters

$field

(BP_XProfile_Field) (Required) XProfile field object.

$request

(array) (Required) request argument.

Return

(array)

Source

File: bp-xprofile/classes/class-bp-rest-xprofile-fields-endpoint.php

	public function get_gender_type_options( $field, $request ) {
		$options = $field->get_children();
		for ( $k = 0, $count = count( $options ); $k < $count; ++ $k ) {
			if ( '1' === $options[ $k ]->option_order ) {
				$options[ $k ]->value = 'his_' . $options[ $k ]->name;
			} elseif ( '2' === $options[ $k ]->option_order ) {
				$options[ $k ]->value = 'her_' . $options[ $k ]->name;
			} else {
				$options[ $k ]->value = 'their_' . $options[ $k ]->name;
			}
		}

		return $options;
	}

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.