Skip to main content

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

PropertyTypeDescription
$reverseboolWhether to reverse the order of the entries.
$startintThe start of the sequence.
$positionstringThe field position in the view.
$UIDstringUID for this field. A unique relation identifier between this field and a view.
$IDstringThe form field ID for this field.
$labelstringThe form label for this field.
$custom_labelstringThe custom label for this field.
$show_labelboolWhether to show the label or not for this field.
$custom_classstringThe custom class for this field.
$capstringThe capability required to view this field. If empty, anyone can view it, including non-logged in users.
$show_as_linkboolShow as a link to entry.
$new_windowboolWhether to open the link in a new window.
$search_filterboolFilter this field from searching.

Methods

MethodDescription
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

NameTypeDefaultDescription
$sourcestringA \GV\Source class as string this field is tied to.
$argsarrayThe 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

NameTypeDefaultDescription
$configurationarrayThe 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

NameTypeDefaultDescription
$view\GV\ViewnullThe view for this context if applicable.
$source\GV\SourcenullThe source (form) for this context if applicable.
$entry\GV\EntrynullThe entry for this context if applicable.
$request\GV\RequestnullThe 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

NameTypeDefaultDescription
$view\GV\ViewnullThe view for this context if applicable.
$source\GV\SourcenullThe source (form) for this context if applicable.
$entry\GV\EntrynullThe entry for this context if applicable.
$request\GV\RequestnullThe 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

NameTypeDefaultDescription
$viewnull

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

NameTypeDefaultDescription
$keystringThe 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

NameTypeDefaultDescription
$keystringThe 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

NameTypeDefaultDescription
$viewView | nullnullThe View object.
$sourceSource | nullnullThe Source object.
$entryEntry | nullnullThe entry object.
$requestRequest | nullnullThe Request object.
$indexstring''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