[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

REST API: WP_REST_Settings_Controller class

File Size: 343 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.


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


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

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

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

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

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

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

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

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

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

return: array Array of registered options.

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

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`.

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

set_additional_properties_to_false( $schema )   X-Ref
Recursively add additionalProperties = false to all objects in a schema
if no additionalProperties setting is specified.

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

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



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref