Meta_Fields

Helper class that handles all supported custom fields provider.

Default fields providers are:

  • ACF
  • Easy Post Types & Fields

Table of Contents

$api  : Api
Api Instance.
$providers  : array<string|int, mixed>
List of providers that provide custom fields.
__construct()  : mixed
Get things started.
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, mixed>
Get list of providers but only the registered ones.
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_api()  : void
Register route specific for custom fields.
register_routes()  : void
Register cf api route.
collect_providers()  : mixed
Find all providers.

Properties

$providers

List of providers that provide custom fields.

public array<string|int, mixed> $providers = []

Methods

__construct()

Get things started.

public __construct(array<string|int, mixed> $services) : mixed
Parameters
$services : array<string|int, mixed>

the list of service providers of the plugin.

Return values
mixed

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_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 list of providers but only the registered ones.

public get_providers() : array<string|int, mixed>
Return values
array<string|int, mixed>

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_api()

Register route specific for custom fields.

public register_api() : void
Return values
void

register_routes()

Register cf api route.

public register_routes() : void
Return values
void

collect_providers()

Find all providers.

private collect_providers(array<string|int, mixed> $services) : mixed
Parameters
$services : array<string|int, mixed>

the list of service providers of the plugin.

Return values
mixed

Search results