BP_REST_Media_Albums_Endpoint::get_endpoint_args_for_item_schema( string $method = WP_REST_Server::CREATABLE )
Select the item schema arguments needed for the CREATABLE methods.
Description
Parameters
- $method
-
(string) (Optional) HTTP method of the request.
Default value: WP_REST_Server::CREATABLE
Return
(array) Endpoint arguments.
Source
File: bp-media/classes/class-bp-rest-media-albums-endpoint.php
public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) { $args = array(); $key = 'update'; $args['title'] = array( 'description' => __( 'New Album Title.', 'buddyboss' ), 'type' => 'string', 'required' => true, 'validate_callback' => 'rest_validate_request_arg', ); $args['privacy'] = array( 'description' => __( 'A unique numeric ID for the Media Album.', 'buddyboss' ), 'type' => 'string', 'default' => 'public', 'enum' => array( 'public', 'loggedin', 'friends', 'onlyme', 'grouponly' ), 'sanitize_callback' => 'sanitize_key', 'validate_callback' => 'rest_validate_request_arg', ); if ( WP_REST_Server::EDITABLE === $method ) { $args['id'] = array( 'description' => __( 'A unique numeric ID for the album.', 'buddyboss' ), 'type' => 'integer', 'required' => true, ); $args['title']['required'] = false; $args['privacy']['required'] = false; } if ( WP_REST_Server::CREATABLE === $method ) { $args['group_id'] = array( 'description' => __( 'A unique numeric ID for the Group.', 'buddyboss' ), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $args['user_id'] = array( 'description' => __( 'The ID for the author of the Album.', 'buddyboss' ), 'default ' => get_current_user_id(), 'type' => 'integer', 'sanitize_callback' => 'absint', 'validate_callback' => 'rest_validate_request_arg', ); $args['upload_ids'] = array( 'description' => __( 'Media specific IDs.', 'buddyboss' ), 'default' => array(), 'type' => 'array', 'items' => array( 'type' => 'integer' ), 'sanitize_callback' => 'wp_parse_id_list', 'validate_callback' => 'rest_validate_request_arg', ); $key = 'create'; } /** * 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_media_{$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.