Custom_Fields implements Registerable, Standard_Service
Custom Fields service.
Tags
Interfaces, Classes and Traits
- Registerable
- Standard_Service
Table of Contents
- $providers : array<string|int, Custom_Fields_Provider>
- List of providers that provide custom fields.
- add_provider() : self
- Add a provider.
- check_permissions() : bool
- Check if the current user can access the cf api.
- get_field_display_value() : mixed
- Get the display value of a field from it's provider.
- get_field_provider() : Custom_Fields_Provider
- Get the provider of a given field.
- get_field_value() : mixed
- Get the value of a field from it's provider.
- get_fields() : array<string|int, mixed>
- Get the list of fields.
- get_providers() : array<string|int, Custom_Fields_Provider>
- Get the providers.
- has_providers() : bool
- Determine if at least one provider has been registered.
- print_fields() : WP_REST_Response
- Returns all fields via the rest api.
- register() : void
- Register the service.
- register_routes() : void
- Register cf api route.
Properties
$providers
List of providers that provide custom fields.
public
array<string|int, Custom_Fields_Provider>
$providers
= []
Methods
add_provider()
Add a provider.
public
add_provider(Custom_Fields_Provider $provider) : self
Parameters
- $provider : Custom_Fields_Provider
-
The provider to add.
Return values
self —check_permissions()
Check if the current user can access the cf api.
public
check_permissions() : bool
Return values
bool —get_field_display_value()
Get the display value of a field from it's provider.
public
get_field_display_value(string $meta_key, string $option) : mixed
Parameters
- $meta_key : string
- $option : string
Return values
mixed —get_field_provider()
Get the provider of a given field.
public
get_field_provider(string $meta_key) : Custom_Fields_Provider
Parameters
- $meta_key : string
Return values
Custom_Fields_Provider —get_field_value()
Get the value of a field from it's provider.
public
get_field_value(string $meta_key, string|int $post_id) : mixed
Parameters
- $meta_key : string
- $post_id : string|int
Return values
mixed —get_fields()
Get the list of fields.
public
get_fields() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_providers()
Get the providers.
public
get_providers() : array<string|int, Custom_Fields_Provider>
Return values
array<string|int, Custom_Fields_Provider> —has_providers()
Determine if at least one provider has been registered.
public
has_providers() : bool
Return values
bool —print_fields()
Returns all fields via the rest api.
public
print_fields() : WP_REST_Response
Return values
WP_REST_Response —register()
Register the service.
public
register() : void
Return values
void —register_routes()
Register cf api route.
public
register_routes() : void