BP_REST_Invites_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
Parameters
- $method
-
(Optional) HTTP method of the request.
Default value: WP_REST_Server::CREATABLE
Return
(array) Endpoint arguments.
Source
File: bp-invites/classes/class-bp-rest-invites-endpoint.php
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | 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 = 'create_item' ; if ( WP_REST_Server::CREATABLE === $method ) { $args = array ( 'fields' => array ( 'description' => __( 'Fields array with name and email_id to create an invites.' , 'buddyboss' ), 'type' => 'array' , 'items' => array ( 'type' => 'object' ), 'required' => true, 'properties' => array ( 'name' => array ( 'description' => __( 'Recipient Name for the invite.' , 'buddyboss' ), 'type' => 'string' , 'required' => true, 'sanitize_callback' => 'sanitize_text_field' , 'validate_callback' => 'rest_validate_request_arg' , ), 'email_id' => array ( 'description' => __( 'Recipient Email for the invite.' , 'buddyboss' ), 'type' => 'string' , 'required' => true, 'sanitize_callback' => 'sanitize_text_field' , 'validate_callback' => 'rest_validate_request_arg' , ), ), ), ); if ( true === bp_check_member_send_invites_tab_member_type_allowed() ) { $args [ 'fields' ][ 'description' ] = __( 'Fields array with name, email_id and profile_type to create an invites.' , 'buddyboss' ); $args [ 'fields' ][ 'properties' ][ 'profile_type' ] = array ( 'description' => __( 'Profile Type for the invite.' , 'buddyboss' ), 'type' => 'string' , 'required' => true, 'sanitize_callback' => 'sanitize_text_field' , 'validate_callback' => 'rest_validate_request_arg' , ); } if ( true === bp_disable_invite_member_email_subject() ) { $args [ 'email_subject' ] = array ( 'description' => __( 'Subject for invite a member.' , 'buddyboss' ), 'type' => 'string' , 'default' => stripslashes ( wp_strip_all_tags( bp_get_member_invitation_subject() ) ), 'validate_callback' => 'rest_validate_request_arg' , ); } if ( true === bp_disable_invite_member_email_content() ) { $args [ 'email_content' ] = array ( 'description' => __( 'Content for invite a member.' , 'buddyboss' ), 'type' => 'string' , 'default' => bp_get_member_invites_wildcard_replace( bp_get_member_invitation_message() ), 'validate_callback' => 'rest_validate_request_arg' , ); } } /** * 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_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.