BP_REST_XProfile_Types_Endpoint::get_item_schema()
Get the XProfile types schema, conforming to JSON Schema.
Description
Return
(array)
Source
File: bp-xprofile/classes/class-bp-rest-xprofile-types-endpoint.php
public function get_item_schema() { $schema = array( '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'bp_xprofile_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, ), ), ), 'has_directory' => array( 'description' => __( 'Whether the profile type should have its own type-specific directory.', 'buddyboss' ), 'type' => 'boolean', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'name' => array( 'description' => __( 'Slug of the member type.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), 'directory_slug' => array( 'description' => __( 'Directory slug of the member type.', 'buddyboss' ), 'type' => 'string', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ), ), ); $post_types = get_post_types(); if ( ! empty( $post_types ) && ( in_array( 'bp-member-type', $post_types, true ) || in_array( 'bmt-member-type', $post_types, true ) // Added support for BP Member Types. ) ) { $schema['properties']['enable_filter'] = array( 'description' => __( 'Display this profile type in "Types" filter in Members Directory.', 'buddyboss' ), 'type' => 'boolean', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); $schema['properties']['enable_remove'] = array( 'description' => __( 'Hide all members of this type from Members Directory.', 'buddyboss' ), 'type' => 'boolean', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); $schema['properties']['enable_profile_field'] = array( 'description' => __( 'Allow users to self-select as this profile type from the "Profile Type" profile field dropdown.', 'buddyboss' ), 'type' => 'boolean', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); if ( bp_is_active( 'groups' ) && function_exists( 'bp_restrict_group_creation' ) && false === bp_restrict_group_creation() ) { $schema['properties']['bp-group-type'] = array( 'description' => __( 'Which group types this profile type is allowed to create.', 'buddyboss' ), 'type' => 'object', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); } if ( bp_is_active( 'groups' ) && function_exists( 'bp_disable_group_type_creation' ) && function_exists( 'bp_enable_group_auto_join' ) && true === bp_disable_group_type_creation() && true === bp_enable_group_auto_join() ) { $schema['properties']['bp-group-type-auto-join'] = array( 'description' => __( 'Group types will automatically approve all membership requests from users of this profile type.', 'buddyboss' ), 'type' => 'object', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); } if ( bp_is_active( 'invites' ) && function_exists( 'bp_disable_invite_member_type' ) && true === bp_disable_invite_member_type() ) { $schema['properties']['bp-member-type-enabled-invite'] = array( 'description' => __( 'Allow members to select the profile type that the invited recipient will be automatically assigned to on registration.', 'buddyboss' ), 'type' => 'boolean', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); $schema['properties']['bp-member-type-invite'] = array( 'description' => __( 'Allowed profile types to select on the email invites.', 'buddyboss' ), 'type' => 'object', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); } $schema['properties']['wp_roles'] = array( 'description' => __( 'Users of this profile type will be auto-assigned to the following WordPress roles.', 'buddyboss' ), 'type' => 'array', 'context' => array( 'embed', 'view', 'edit' ), 'readonly' => true, ); } /** * Filters the xprofile field group schema. * * @param array $schema The endpoint schema. */ return apply_filters( 'bp_rest_xprofile_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.