[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/rest-api/endpoints/ -> class-wp-rest-settings-controller.php (summary)

REST API: WP_REST_Settings_Controller class

File Size: 352 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_REST_Settings_Controller:: (10 methods):
  __construct()
  register_routes()
  get_item_permissions_check()
  get_item()
  prepare_value()
  update_item()
  get_registered_options()
  get_item_schema()
  sanitize_callback()
  set_additional_properties_to_false()


Class: WP_REST_Settings_Controller  - X-Ref

Core class used to manage a site's settings via the REST API.

__construct()   X-Ref
Constructor.

since: 4.7.0

register_routes()   X-Ref
Registers the routes for the site's settings.

since: 4.7.0

get_item_permissions_check( $request )   X-Ref
Checks if a given request has access to read and manage settings.

since: 4.7.0
return: bool True if the request has read access for the item, otherwise false.
param: WP_REST_Request $request Full details about the request.

get_item( $request )   X-Ref
Retrieves the settings.

since: 4.7.0
return: array|WP_Error Array on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

prepare_value( $value, $schema )   X-Ref
Prepares a value for output based off a schema array.

since: 4.7.0
return: mixed The prepared value.
param: mixed $value  Value to prepare.
param: array $schema Schema to match.

update_item( $request )   X-Ref
Updates settings for the settings object.

since: 4.7.0
return: array|WP_Error Array on success, or error object on failure.
param: WP_REST_Request $request Full details about the request.

get_registered_options()   X-Ref
Retrieves all of the registered options for the Settings API.

since: 4.7.0
return: array Array of registered options.

get_item_schema()   X-Ref
Retrieves the site setting schema, conforming to JSON Schema.

since: 4.7.0
return: array Item schema data.

sanitize_callback( $value, $request, $param )   X-Ref
Custom sanitize callback used for all options to allow the use of 'null'.

By default, the schema of settings will throw an error if a value is set to
`null` as it's not a valid value for something like "type => string". We
provide a wrapper sanitizer to allow the use of `null`.

since: 4.7.0
return: mixed|WP_Error
param: mixed           $value   The value for the setting.
param: WP_REST_Request $request The request object.
param: string          $param   The parameter name.

set_additional_properties_to_false( $schema )   X-Ref
Recursively add additionalProperties = false to all objects in a schema.

This is need to restrict properties of objects in settings values to only
registered items, as the REST API will allow additional properties by
default.

since: 4.9.0
return: array
param: array $schema The schema array.



Generated: Sun Apr 28 01:00:03 2024 Cross-referenced by PHPXref 0.7.1