BP_REST_XProfile_Field_Groups_Endpoint::get_item_schema()

Get the XProfile field group schema, conforming to JSON Schema.

Description

Return

(array)

Source

File: bp-xprofile/classes/class-bp-rest-xprofile-field-groups-endpoint.php

	public function get_item_schema() {
		$schema = array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => 'bp_xprofile_group',
			'type'       => 'object',
			'properties' => array(
				'id'               => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'A unique numeric ID for the group of profile fields.', 'buddyboss' ),
					'readonly'    => true,
					'type'        => 'integer',
				),
				'name'             => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'The name of group of profile fields.', 'buddyboss' ),
					'type'        => 'string',
					'arg_options' => array(
						'sanitize_callback' => 'sanitize_text_field',
					),
				),
				'description'      => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'The description of the group of profile fields.', 'buddyboss' ),
					'type'        => 'object',
					'arg_options' => array(
						'sanitize_callback' => null,
						// Note: sanitization implemented in self::prepare_item_for_database().
						'validate_callback' => null,
						// Note: validation implemented in self::prepare_item_for_database().
					),
					'properties'  => array(
						'raw'      => array(
							'description' => __( 'Content for the group of profile fields, as it exists in the database.', 'buddyboss' ),
							'type'        => 'string',
							'context'     => array( 'edit' ),
						),
						'rendered' => array(
							'description' => __( 'HTML content for the group of profile fields, transformed for display.', 'buddyboss' ),
							'type'        => 'string',
							'context'     => array( 'embed', 'view', 'edit' ),
							'readonly'    => true,
						),
					),
				),
				'group_order'      => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'The order of the group of profile fields.', 'buddyboss' ),
					'type'        => 'integer',
				),
				'can_delete'       => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'Whether the group of profile fields can be deleted or not.', 'buddyboss' ),
					'type'        => 'boolean',
				),
				'repeater_enabled' => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'Whether the group of profile fields can be repeated or not.', 'buddyboss' ),
					'type'        => 'boolean',
				),
				'fields'           => array(
					'context'     => array( 'embed', 'view', 'edit' ),
					'description' => __( 'The fields associated with this group of profile fields.', 'buddyboss' ),
					'type'        => 'array',
					'readonly'    => true,
				),
			),
		);

		/**
		 * Filters the xprofile field group schema.
		 *
		 * @param array $schema The endpoint schema.
		 */
		return apply_filters( 'bp_rest_xprofile_field_group_schema', $this->add_additional_fields_schema( $schema ) );
	}

Changelog

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.