BP_REST_Members_Details_Endpoint::prepare_child_navigation( object $child_navigation, WP_REST_Request $request )

Prepare children navigation.

Description

Parameters

$child_navigation

(Required) Child Navigation.

$request

(Required) Full details about the request.

Return

(array) An array of child Navigation.

Source

File: bp-members/classes/class-bp-rest-members-details-endpoint.php

	protected function prepare_child_navigation( $child_navigation, $request ) {
		$data = array();

		if ( empty( $child_navigation ) ) {
			return $data;
		}

		foreach ( $child_navigation as $child ) {
			$data[] = $this->prepare_response_for_collection(
				$this->prepare_item_for_response( (object) $child, $request )
			);
		}

		/**
		 * Filter sub navigation returned from the API.
		 *
		 * @since 0.1.0
		 *
		 * @param object          $child_navigation Child navigation.
		 * @param WP_REST_Request $request          Request used to generate the response.
		 *
		 * @param array           $data             An array of sub navigation.
		 */
		return apply_filters( 'bp_rest_profile_dropdown_prepare_children', $data, $child_navigation, $request );
	}

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.