BP_REST_XProfile_Fields_Endpoint::prepare_links( BP_XProfile_Field $field )

Prepare links for the request.


Parameters Parameters

$field

(BP_XProfile_Field) (Required) XProfile field object.


Top ↑

Return Return

(array)


Source Source

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

	protected function prepare_links( $field ) {
		$base       = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
		$group_base = sprintf( '/%s/%s/', $this->namespace, '/xprofile/groups/' );

		// Entity meta.
		$links = array(
			'self'       => array(
				'href' => rest_url( $base . $field->id ),
			),
			'collection' => array(
				'href' => rest_url( $base ),
			),
			'group' => array(
				'href'       => rest_url( $group_base . $field->group_id ),
				'embeddable' => true,
			),
		);

		/**
		 * Filter links prepared for the REST response.
		 *
		 * @since 5.0.0
		 *
		 * @param array             $links The prepared links of the REST response.
		 * @param BP_XProfile_Field $field XProfile field object.
		 */
		return apply_filters( 'bp_rest_xprofile_fields_prepare_links', $links, $field );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.