AbstractSchema
in package
Abstract REST Schema for WooCommerce REST API V4.
Provides common functionality for all V4 schema controllers including property generation, context filtering, and validation.
Tags
Table of Contents
- IDENTIFIER = ''
- The schema item identifier.
- VIEW_EDIT_CONTEXT = array('view', 'edit')
- Context for the item schema - view and edit only.
- VIEW_EDIT_EMBED_CONTEXT = array('view', 'edit', 'embed')
- Context for the item schema - view, edit, and embed.
- get_item_response() : array<string|int, mixed>
- Get the item response.
- get_item_schema() : array<string|int, mixed>
- Get the item schema.
- get_item_schema_properties() : array<string|int, mixed>
- Return all properties for the item schema.
- get_writable_item_schema_properties() : array<string|int, mixed>
- Return all writable properties for the item schema.
- filter_writable_props() : bool
- Filter schema properties to only return writable ones.
Constants
IDENTIFIER
The schema item identifier.
public
string
IDENTIFIER
= ''
Tags
VIEW_EDIT_CONTEXT
Context for the item schema - view and edit only.
public
array<string|int, mixed>
VIEW_EDIT_CONTEXT
= array('view', 'edit')
Tags
VIEW_EDIT_EMBED_CONTEXT
Context for the item schema - view, edit, and embed.
public
array<string|int, mixed>
VIEW_EDIT_EMBED_CONTEXT
= array('view', 'edit', 'embed')
Tags
Methods
get_item_response()
Get the item response.
public
abstract get_item_response(mixed $item, WP_REST_Request $request[, array<string|int, mixed> $include_fields = array() ]) : array<string|int, mixed>
Parameters
- $item : mixed
-
WordPress representation of the item.
- $request : WP_REST_Request
-
Request object.
- $include_fields : array<string|int, mixed> = array()
-
Fields to include in the response.
Return values
array<string|int, mixed> — The item response.get_item_schema()
Get the item schema.
public
get_item_schema() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> — The item schema.get_item_schema_properties()
Return all properties for the item schema.
public
get_item_schema_properties() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> — The schema properties.get_writable_item_schema_properties()
Return all writable properties for the item schema.
public
get_writable_item_schema_properties() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> — The schema properties.filter_writable_props()
Filter schema properties to only return writable ones.
protected
filter_writable_props(array<string|int, mixed> $schema) : bool
Parameters
- $schema : array<string|int, mixed>
-
The schema property to check.
