[ 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: 342 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.

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.

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.

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.

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.

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

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

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



Generated : Fri Apr 26 08:20:02 2024 Cross-referenced by PHPXref