Skip to main content

Gravity_Forms\Gravity_Forms\Settings\Fields\Generic_Map

Source: includes/settings/fields/class-generic-map.php:13

Details​

  • Kind: class
  • Namespace: Gravity_Forms\Gravity_Forms\Settings\Fields
  • Extends: Base

Properties​

PropertyTypeDescription
$typestringField type.
$limitintNumber of mappings allowed.
$invalid_choicesarrayRequired choices that were not selected on save.
$key_fieldarrayKey field properties.
$value_fieldarrayValue field properties.

Methods​

MethodDescription
__construct()Initialize Generic Map field.
markup()Render field.
get_container_classes()Gets the classes to apply to the field container.
populate_default_key_values()Populate key field choices with their default mappings.
get_value_choices()Get choices for value field.
do_validation()Validate posted field value.
get_required_choices()Get choices that are required to be filled out.
save()Modify field value before saving.

Method Reference​

__construct()​

public function __construct( $props, $settings )

Initialize Generic Map field.

Parameters​

NameTypeDefaultDescription
$propsarrayField properties.
$settings\Gravity_Forms\Gravity_Forms\Settings\SettingsSettings framework instance.

Since: 2.5

Source: includes/settings/fields/class-generic-map.php:85

markup()​

public function markup()

Render field.

This contains the hidden input used to manage the state of the field and is also updated via react. This also contains the initializeFieldMap method which inits the react for the field and passes along the various props to then be used in the react app.

Returns​

  • string

Since: 2.5

Source: includes/settings/fields/class-generic-map.php:229

get_container_classes()​

public function get_container_classes()

Gets the classes to apply to the field container.

Removes invalid class.

Returns​

  • string

Since: 2.5

Source: includes/settings/fields/class-generic-map.php:288

populate_default_key_values()​

public function populate_default_key_values( $choices )

Populate key field choices with their default mappings.

Parameters​

NameTypeDefaultDescription
$choicesarrayExisting choices.

Returns​

  • array

Since: 2.5

Source: includes/settings/fields/class-generic-map.php:312

get_value_choices()​

public function get_value_choices( $required_types=[], $excluded_types=[] )

Get choices for value field.

Parameters​

NameTypeDefaultDescription
$required_typesarray[]Required field types.
$excluded_typesarray[]Excluded field types.

Returns​

  • array

Since: 2.5

Source: includes/settings/fields/class-generic-map.php:388

do_validation()​

public function do_validation( $value )

Validate posted field value.

Parameters​

NameTypeDefaultDescription
$valuearray | bool | stringPosted field value.

Since: 2.5

Source: includes/settings/fields/class-generic-map.php:713

get_required_choices()​

public function get_required_choices()

Get choices that are required to be filled out.

Returns​

  • array

Since: 2.5

Source: includes/settings/fields/class-generic-map.php:762

save()​

public function save( $value )

Modify field value before saving.

Parameters​

NameTypeDefaultDescription
$valuearray | bool | string

Returns​

  • array | bool | string

Since: 2.5

Source: includes/settings/fields/class-generic-map.php:804