BP_REST_Group_Invites_Endpoint::get_endpoint_args_for_item_schema( string $method = WP_REST_Server::CREATABLE, boolean $multiple = false )
Edit the type of the some properties for the CREATABLE & EDITABLE methods.
Description
Parameters
- $method
-
(Optional) HTTP method of the request.
Default value: WP_REST_Server::CREATABLE
- $multiple
-
(Optional) Is multiple invite or not.
Default value: false
Return
(array) Endpoint arguments.
Source
File: bp-groups/classes/class-bp-rest-group-invites-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['message']['type'] = 'string'; $args['message']['description'] = __( 'The optional message to send to the invited user.', 'buddyboss' ); $args['send_invite'] = $args['invite_sent']; $args['inviter_id']['default'] = bp_loggedin_user_id(); $args['group_id']['required'] = true; $args['user_id']['required'] = true; // Remove arguments not needed for the CREATABLE transport method. unset( $args['message']['properties'], $args['invite_sent'], $args['date_modified'], $args['type'] ); $args['send_invite']['description'] = __( 'Whether the invite should be sent to the invitee.', 'buddyboss' ); $args['send_invite']['default'] = true; if ( WP_REST_Server::EDITABLE === $method ) { $key = 'update_item'; } } elseif ( WP_REST_Server::DELETABLE === $method ) { $key = 'delete_item'; } /** * Filters the method query arguments. * * @param array $args Query arguments. * @param string $method HTTP method of the request. * * @since 0.1.0 */ return apply_filters( "bp_rest_group_invites_{$key}_query_arguments", $args, $method ); }
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.