Skip to main content

GV\GF_Field

The Gravity Forms {@see \GF_Field} field object wrapper.

Source: future/includes/class-gv-field-gravityforms.php:16

Details

  • Kind: class
  • Namespace: GV
  • Extends: Field

Properties

PropertyTypeDescription
$field\GF_FieldThe backing Gravity Forms field.

Methods

MethodDescription
by_id()Get a \GV\GF_Field by \GV\GF_Form and Field ID.
get_label()Retrieve the label for this field.
get_value()Retrieve the value for this field.
__get()A proxy getter for the backing GravityView field.
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

by_id()

public static function by_id( $form, $field_id )

Get a \GV\GF_Field by \GV\GF_Form and Field ID.

Parameters

NameTypeDefaultDescription
$form\GV\GF_FormThe Gravity Form form.
$field_idintThe Gravity Form field ID for the $form.

Returns

  • \GV\Field | null — The requested field or null if not found.

Source: future/includes/class-gv-field-gravityforms.php:87

get_label()

public function get_label( View $view=null, Source $source=null, Entry $entry=null, Request $request=null )

Retrieve the label for this field.

Requires a \GV\GF_Form in this implementation.

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 Gravity Forms field.

Source: future/includes/class-gv-field-gravityforms.php:133

get_value()

public function get_value( View $view=null, Source $source=null, Entry $entry=null, Request $request=null )

Retrieve the value for this field.

Requires a \GV\GF_Entry in this implementation.

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-gravityforms.php:180

__get()

public function __get( $key )

A proxy getter for the backing GravityView field.

The view field configuration is checked first, though.

Parameters

NameTypeDefaultDescription
$keystringThe property to get.

Returns

  • mixed — The value of the Gravity View field property, or null if not exists.

Source: future/includes/class-gv-field-gravityforms.php:207

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-gravityforms.php:222

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-gravityforms.php:238