Validation
in package
Service class validating checkout field schema.
Table of Contents
- $meta_schema_json : string
- Meta schema.
- get_field_schema_with_context() : array<string|int, mixed>
- Get the field schema with context.
- has_field_schema() : bool
- Check if the fields have defined schema.
- is_valid_schema() : bool|WP_Error
- Validate meta schema for field rules.
- validate_document_object() : bool|WP_Error
- Validate the field rules.
Properties
$meta_schema_json
Meta schema.
private
static string
$meta_schema_json
= ''
Methods
get_field_schema_with_context()
Get the field schema with context.
public
static get_field_schema_with_context(string $field_id, array<string|int, mixed> $field_schema, string $context) : array<string|int, mixed>
Parameters
- $field_id : string
-
The field ID.
- $field_schema : array<string|int, mixed>
-
The field schema.
- $context : string
-
The context.
Return values
array<string|int, mixed> —has_field_schema()
Check if the fields have defined schema.
public
static has_field_schema(array<string|int, mixed> $fields) : bool
Parameters
- $fields : array<string|int, mixed>
-
The fields.
Return values
bool —is_valid_schema()
Validate meta schema for field rules.
public
static is_valid_schema(array<string|int, mixed> $rules) : bool|WP_Error
Parameters
- $rules : array<string|int, mixed>
-
The field rules.
Return values
bool|WP_Error — True if the field options are valid, a WP_Error otherwise.validate_document_object()
Validate the field rules.
public
static validate_document_object(DocumentObject $document_object, array<string|int, mixed> $rules) : bool|WP_Error
Parameters
- $document_object : DocumentObject
-
The document object to validate.
- $rules : array<string|int, mixed>
-
The rules to validate against.