GV\Field
The default GravityView Field class.
Houses all base Field functionality.
Source: future/includes/class-gv-field.php:14
Details
- Kind:
class - Namespace:
GV - Extends:
stdClass
Properties
| Property | Type | Description |
|---|---|---|
$reverse | bool | Whether to reverse the order of the entries. |
$start | int | The start of the sequence. |
$position | string | The field position in the view. |
$UID | string | UID for this field. A unique relation identifier between this field and a view. |
$ID | string | The form field ID for this field. |
$label | string | The form label for this field. |
$custom_label | string | The custom label for this field. |
$show_label | bool | Whether to show the label or not for this field. |
$custom_class | string | The custom class for this field. |
$cap | string | The capability required to view this field. If empty, anyone can view it, including non-logged in users. |
$show_as_link | bool | Show as a link to entry. |
$new_window | bool | Whether to open the link in a new window. |
$search_filter | bool | Filter this field from searching. |
Methods
| Method | Description |
|---|---|
get() | An alias for \GV\Source::get_field() |
update_configuration() | Update configuration. |
get_label() | Retrieve the label for this field. |
get_value() | Retrieve the value for this field. |
is_visible() | Whether or not this field is visible. |
__get() | Get one of the extra configuration keys via property accessors. |
__isset() | Is this set? |
get_ancestors_ids() | Returns all the ancestors for this field, in order from root to this field. |
get_results() | Returns the results this field will produce on the entry. |
Method Reference
get()
final public static function get( $source, $args )
An alias for \GV\Source::get_field()
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$source | string | A \GV\Source class as string this field is tied to. | |
$args | array | The arguments required for the backend to fetch the field (usually just the ID). |
Returns
- \GV\Field |
null— A \GV\Field instance or null if not found.
See Also
Source: future/includes/class-gv-field.php:168
update_configuration()
public function update_configuration( $configuration )
Update configuration.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$configuration | array | The configuration array. |
Returns
void
See Also
Since: 2.0
Source: future/includes/class-gv-field.php:267
get_label()
public function get_label( View $view=null, Source $source=null, Entry $entry=null, Request $request=null )
Retrieve the label for this field.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | \GV\View | null | The view for this context if applicable. |
$source | \GV\Source | null | The source (form) for this context if applicable. |
$entry | \GV\Entry | null | The entry for this context if applicable. |
$request | \GV\Request | null | The request for this context if applicable. |
Returns
string— The label for this field. Nothing here.
Source: future/includes/class-gv-field.php:319
get_value()
public function get_value( View $view=null, Source $source=null, Entry $entry=null, Request $request=null )
Retrieve the value for this field.
Returns null in this implementation (or, rather, lack thereof).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | \GV\View | null | The view for this context if applicable. |
$source | \GV\Source | null | The source (form) for this context if applicable. |
$entry | \GV\Entry | null | The entry for this context if applicable. |
$request | \GV\Request | null | The request for this context if applicable. |
Returns
mixed— The value for this field.
Source: future/includes/class-gv-field.php:349
is_visible()
public function is_visible( $view=null )
Whether or not this field is visible.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | null |
Returns
bool
Since: develop
Source: future/includes/class-gv-field.php:404
__get()
public function __get( $key )
Get one of the extra configuration keys via property accessors.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | The key to get. |
Returns
mixed|null— The value for the given configuration key, null if doesn't exist.
Source: future/includes/class-gv-field.php:424
__isset()
public function __isset( $key )
Is this set?
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | The key to get. |
Returns
boolean— Whether this $key is set or not.
Source: future/includes/class-gv-field.php:442
get_ancestors_ids()
public function get_ancestors_ids(): array
Returns all the ancestors for this field, in order from root to this field.
Note: this is for fields that are nested, like repeater fields.
Returns
int[]— The ancestor IDs.
Since: 2.51.0
Source: future/includes/class-gv-field.php:458
get_results()
public function get_results( ?View $view=null, ?Source $source=null, ?Entry $entry=null, ?Request $request=null, string $index='' ): array
Returns the results this field will produce on the entry.
Note: This means that the field is present inside a repeater field, for example. It does not mean the field has multiple values, like a checkbox.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | View | null | null | The View object. |
$source | Source | null | null | The Source object. |
$entry | Entry | null | null | The entry object. |
$request | Request | null | null | The Request object. |
$index | string | '' | The nesting index. For example '0', '0.0', '0.1' ,'1.0', '0.0.1', etc. |
Returns
array— The results per index. If no index is provided, returns all results.
Since: 2.51.0
Source: future/includes/class-gv-field.php:479