BP_REST_Settings_Endpoint::get_item_schema()

Get the settings schema, conforming to JSON Schema.

Description

Return

(array)

Source

File: bp-core/classes/class-bp-rest-settings-endpoint.php

148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
public function get_item_schema() {
    $schema = array(
        '$schema'    => 'http://json-schema.org/draft-04/schema#',
        'title'      => 'bp_settings',
        'type'       => 'object',
        'properties' => array(
            'name'        => array(
                'context'     => array( 'view' ),
                'description' => __( 'Name of the setting.', 'buddyboss' ),
                'type'        => 'string',
                'arg_options' => array(
                    'sanitize_callback' => 'sanitize_key',
                ),
            ),
            'status'      => array(
                'context'     => array( 'view' ),
                'description' => __( 'Whether the setting is active or inactive.', 'buddyboss' ),
                'type'        => 'string',
                'enum'        => array( 'active', 'inactive' ),
                'arg_options' => array(
                    'sanitize_callback' => 'sanitize_key',
                ),
            ),
            'title'       => array(
                'context'     => array( 'view' ),
                'description' => __( 'Title of the setting.', 'buddyboss' ),
                'type'        => 'string',
                'arg_options' => array(
                    'sanitize_callback' => 'sanitize_text_field',
                ),
            ),
            'description' => array(
                'context'     => array( 'view' ),
                'description' => __( 'Description of the setting.', 'buddyboss' ),
                'type'        => 'string',
                'arg_options' => array(
                    'sanitize_callback' => 'sanitize_text_field',
                ),
            ),
        ),
    );
 
    /**
     * Filters the settings schema.
     *
     * @param string $schema The endpoint schema.
     */
    return apply_filters( 'bp_rest_settings_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.