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

return: bool True if the request has read access for the item, otherwise false.
since: 4.7.0
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.
since: 4.7.0
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.
since: 4.7.0
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.
since: 4.7.0
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.
since: 4.7.0

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

return: array Item schema data.
since: 4.7.0

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
since: 4.7.0
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.

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



Generated: Sat Dec 21 01:00:02 2024 Cross-referenced by PHPXref 0.7.1