BP_REST_Groups_Types_Endpoint::get_item_schema()
Get the Groups types schema, conforming to JSON Schema.
Description
Return
(array)
Source
File: bp-groups/classes/class-bp-rest-groups-types-endpoint.php
public function get_item_schema() {
$schema = array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'bp_groups_types',
'type' => 'object',
'properties' => array(
'labels' => array(
'context' => array( 'embed', 'view', 'edit' ),
'description' => __( 'Labels to use in various parts of the interface.', 'buddyboss' ),
'type' => 'object',
'arg_options' => array(
'sanitize_callback' => null,
'validate_callback' => null,
),
'properties' => array(
'name' => array(
'description' => __( 'Default name. Should typically be plural.', 'buddyboss' ),
'type' => 'string',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'singular_name' => array(
'description' => __( 'Singular name.', 'buddyboss' ),
'type' => 'string',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
),
),
'name' => array(
'description' => __( 'Slug of the group type.', 'buddyboss' ),
'type' => 'string',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'description' => array(
'description' => __( 'Description of the group type.', 'buddyboss' ),
'type' => 'string',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'directory_slug' => array(
'description' => __( 'Directory slug of the group type.', 'buddyboss' ),
'type' => 'string',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'has_directory' => array(
'description' => __( 'Whether the group type should have its own type-specific directory.', 'buddyboss' ),
'type' => 'boolean',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'show_in_create_screen' => array(
'description' => __( 'Whether this group type is allowed to be selected on the group creation page.', 'buddyboss' ),
'type' => 'boolean',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'show_in_list' => array(
'description' => __( 'Whether this group type should be shown in lists.', 'buddyboss' ),
'type' => 'boolean',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
'create_screen_checked' => array(
'description' => __( 'Whether we should have our group type checkbox checked by default on group create.', 'buddyboss' ),
'type' => 'boolean',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
),
),
);
$post_types = get_post_types();
if ( ! empty( $post_types ) && in_array( 'bp-group-type', $post_types, true ) ) {
$schema['properties']['enable_filter'] = array(
'description' => __( 'Display this group type in "Types" filter in Groups Directory.', 'buddyboss' ),
'type' => 'boolean',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
);
$schema['properties']['enable_remove'] = array(
'description' => __( 'Hide all groups of this type from Groups Directory.', 'buddyboss' ),
'type' => 'boolean',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
);
$schema['properties']['restrict-invites-user-same-group-type'] = array(
'description' => __( 'If a member is already in a group of this type, they cannot be sent an invite to join another group of this type.', 'buddyboss' ),
'type' => 'boolean',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
);
$schema['properties']['member_type_group_invites'] = array(
'description' => __( 'Only members of the selected profile types may be sent requests to join this group.', 'buddyboss' ),
'type' => 'object',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
);
$schema['properties']['member_type_join'] = array(
'description' => __( 'Members of the selected profile types can always join groups of this type, even if the group is private.', 'buddyboss' ),
'type' => 'object',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
);
$schema['properties']['group_type_role_labels'] = array(
'description' => __( 'Rename the group member roles for groups of this type.', 'buddyboss' ),
'type' => 'object',
'context' => array( 'embed', 'view', 'edit' ),
'readonly' => true,
);
}
/**
* Filters the groups types field schema.
*
* @param array $schema The endpoint schema.
*/
return apply_filters( 'bp_rest_groups_types_schema', $schema );
}
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.