BP_REST_Groups_Endpoint::get_endpoint_args_for_item_schema( string $method = WP_REST_Server::CREATABLE )

Edit some arguments for the endpoint’s CREATABLE and EDITABLE methods.


Description Description


Parameters Parameters

$method

(Optional) HTTP method of the request.

Default value: WP_REST_Server::CREATABLE


Top ↑

Return Return

(array) Endpoint arguments.


Top ↑

Source Source

File: bp-groups/classes/class-bp-rest-groups-endpoint.php

	public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) {
		$args = WP_REST_Controller::get_endpoint_args_for_item_schema( $method );
		$key  = 'get_item';

		if ( WP_REST_Server::CREATABLE === $method || WP_REST_Server::EDITABLE === $method ) {
			$key                         = 'create_item';
			$args['description']['type'] = 'string';

			if ( WP_REST_Server::EDITABLE === $method ) {
				$key = 'update_item';
				unset( $args['slug'] );
			}
		} elseif ( WP_REST_Server::DELETABLE === $method ) {
			$key = 'delete_item';
		}

		/**
		 * Filters the method query arguments.
		 *
		 * @since 5.0.0
		 *
		 * @param array  $args   Query arguments.
		 * @param string $method HTTP method of the request.
		 */
		return apply_filters( "bp_rest_groups_{$key}_query_arguments", $args, $method );
	}

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.