ACF Helper

FieldVisibility extends Field
in package

Field Visibility class

Table of Contents

$contextId  : string
The context ID.
$field  : array<string|int, mixed>
The actual field.
$key  : string
The field key.
$postId  : int
The post ID.
$userId  : int
The post ID.
get()  : mixed
Get the object.
getIsolatedVisibility()  : bool
Get the isolated field visibility.
getName()  : string
Get the field value.
getParents()  : array<string|int, mixed>
Get all parent fields.
getValue()  : mixed
Get an ACF field by its key or name (regardless if it is a sub field of a group field or not).
hasParent()  : bool
Has a field a parent field? (Not a field group)
isParent()  : bool
Is the given field related to another field?
isVisible()  : bool
Determine if a given field is visble based on its conditional logic.
setContextId()  : static
Set the context ID.
setKey()  : static
Set the field key.
setPostId()  : static
Set the post ID.
setUserId()  : static
Set the user ID.
walkUp()  : mixed
Walk up the field tree and chek each parent with a custom callback.

Properties

$contextId

The context ID.

public static string $contextId

$field

The actual field.

public static array<string|int, mixed> $field

$key

The field key.

public static string $key

$postId

The post ID.

public static int $postId

$userId

The post ID.

public static int $userId

Methods

get()

Get the object.

public abstract static get([string $key = null ]) : mixed
Parameters
$key : string = null

Key to any value stored in the object.

Return values
mixed

getIsolatedVisibility()

Get the isolated field visibility.

public static getIsolatedVisibility(array<string|int, mixed> $field) : bool
Parameters
$field : array<string|int, mixed>
Return values
bool

getParents()

Get all parent fields.

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

getValue()

Get an ACF field by its key or name (regardless if it is a sub field of a group field or not).

public static getValue() : mixed
Return values
mixed

hasParent()

Has a field a parent field? (Not a field group)

public static hasParent() : bool
Return values
bool

isParent()

Is the given field related to another field?

public static isParent(string $maybeRelatedFieldKey) : bool
Parameters
$maybeRelatedFieldKey : string
Return values
bool

isVisible()

Determine if a given field is visble based on its conditional logic.

public static isVisible() : bool
Return values
bool

setContextId()

Set the context ID.

public static setContextId(string $contextId) : static
Parameters
$contextId : string

The context ID.

Return values
static

setKey()

Set the field key.

public static setKey(string $key) : static
Parameters
$key : string

The field key.

Return values
static

setPostId()

Set the post ID.

public static setPostId(int $postId) : static
Parameters
$postId : int

The post ID.

Return values
static

setUserId()

Set the user ID.

public static setUserId(int $userId) : static
Parameters
$userId : int

The user ID.

Return values
static

walkUp()

Walk up the field tree and chek each parent with a custom callback.

public static walkUp(callable $callback) : mixed
Parameters
$callback : callable
Return values
mixed

Search results