BP_REST_XProfile_Fields_Endpoint::prepare_item_for_response( BP_XProfile_Field $field, WP_REST_Request $request )

Prepares single XProfile field data to return as an object.

Description

Parameters

$field

(Required) XProfile field object.

$request

(Required) Full data about the request.

Return

(WP_REST_Response)

Source

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

	public function prepare_item_for_response( $field, $request ) {
		$response = rest_ensure_response(
			$this->assemble_response_data( $field, $request )
		);
		$response->add_links( $this->prepare_links( $field ) );

		/**
		 * Filter the XProfile field returned from the API.
		 *
		 * @param WP_REST_Response $response The response data.
		 * @param WP_REST_Request $request Request used to generate the response.
		 * @param BP_XProfile_Field $field XProfile field object.
		 *
		 * @since 0.1.0
		 */
		return apply_filters( 'bp_rest_xprofile_fields_prepare_value', $response, $request, $field );
	}

Changelog

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