WC_REST_Email_Settings_V4_Controller
extends WC_REST_V4_Controller
in package
REST API Email Settings controller class.
Tags
Table of Contents
- $namespace : string
- Endpoint namespace.
- $rest_base : string
- Route base.
- get_item() : WP_REST_Response|WP_Error
- Get email settings.
- get_item_permissions_check() : bool|WP_Error
- Check permissions for reading email settings.
- get_item_schema() : array<string|int, mixed>
- Get the schema for email settings, conforming to JSON Schema.
- prepare_response_for_collection() : array<string|int, mixed>
- Prepare a response for inserting into a collection.
- register_routes() : mixed
- Register routes.
- update_item() : WP_REST_Response|WP_Error
- Update email settings.
- update_item_permissions_check() : bool|WP_Error
- Check permissions for updating email settings.
- check_permissions() : bool|WP_Error
- Check permissions for a given request.
- get_api_version() : string
- Get the default REST API version.
- get_base_schema() : array<string|int, mixed>
- Get the base schema for the API.
- get_email_settings_data() : array<string|int, mixed>
- Get email settings data by transforming email settings into REST API format.
- get_field_schema() : array<string|int, mixed>
- Get the schema for individual setting fields.
- get_update_args() : array<string|int, mixed>
- Get update arguments for the endpoint.
- sanitize_setting_value() : mixed
- Sanitize setting value based on setting ID.
- validate_setting_value() : bool|WP_Error
- Validate a setting value before updating.
Properties
$namespace
Endpoint namespace.
protected
string
$namespace
= 'wc/v4'
$rest_base
Route base.
protected
string
$rest_base
= 'settings/email'
Methods
get_item()
Get email settings.
public
get_item(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
-
Full details about the request.
Return values
WP_REST_Response|WP_Error —get_item_permissions_check()
Check permissions for reading email settings.
public
get_item_permissions_check(WP_REST_Request $request) : bool|WP_Error
Parameters
- $request : WP_REST_Request
-
Full details about the request.
Return values
bool|WP_Error —get_item_schema()
Get the schema for email settings, conforming to JSON Schema.
public
get_item_schema() : array<string|int, mixed>
Return values
array<string|int, mixed> —prepare_response_for_collection()
Prepare a response for inserting into a collection.
public
prepare_response_for_collection(WP_REST_Response $response) : array<string|int, mixed>
Parameters
- $response : WP_REST_Response
-
Response object.
Return values
array<string|int, mixed> — Response data.register_routes()
Register routes.
public
register_routes() : mixed
Return values
mixed —update_item()
Update email settings.
public
update_item(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
-
Full details about the request.
Return values
WP_REST_Response|WP_Error —update_item_permissions_check()
Check permissions for updating email settings.
public
update_item_permissions_check(WP_REST_Request $request) : bool|WP_Error
Parameters
- $request : WP_REST_Request
-
Full details about the request.
Return values
bool|WP_Error —check_permissions()
Check permissions for a given request.
protected
check_permissions(WP_REST_Request $request[, string $permission = 'read' ]) : bool|WP_Error
Parameters
- $request : WP_REST_Request
-
Full details about the request.
- $permission : string = 'read'
-
The permission to check for.
Return values
bool|WP_Error —get_api_version()
Get the default REST API version.
protected
get_api_version() : string
Return values
string —get_base_schema()
Get the base schema for the API.
protected
get_base_schema() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_email_settings_data()
Get email settings data by transforming email settings into REST API format.
private
get_email_settings_data() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_field_schema()
Get the schema for individual setting fields.
private
get_field_schema() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_update_args()
Get update arguments for the endpoint.
private
get_update_args() : array<string|int, mixed>
Return values
array<string|int, mixed> —sanitize_setting_value()
Sanitize setting value based on setting ID.
private
sanitize_setting_value(string $setting_id, mixed $value) : mixed
Parameters
- $setting_id : string
-
Setting ID.
- $value : mixed
-
Setting value.
Return values
mixed — Sanitized value.validate_setting_value()
Validate a setting value before updating.
private
validate_setting_value(string $setting_id, mixed $value, string $reply_to_enabled) : bool|WP_Error
Parameters
- $setting_id : string
-
Setting ID.
- $value : mixed
-
Setting value.
- $reply_to_enabled : string
-
Reply-to enabled.
