Obtaining Your Capsule CRM API Key

Obtaining Your Capsule CRM API Key

To use the Capsule CRM Add-On, you will need to first obtain your Capsule CRM API key. In this article, we will show you exactly how to find it.

Log into your Capsule CRM account.
Click on your name at the top right corner and then on My Preferences.
From the left side menu, click API Authentication Tokens.
Under Personal Access Tokens, click the Generate new API token button.

Give the token a Description, and check the boxes as applicable.

Click the Save new Token button.

Now you can copy the token to use in your Gravity Forms Capsule CRM settings.
If you need further help to get your API key, we recommend you contact Capsule CRM support.

GF_DEBUG

GF_DEBUG

DescriptionUsagePlacement

Description
This constant helps debugging problems with AJAX forms by allowing the contents of the AJAX iframe to be viewed. Set the constant to true to display the contents.
Usage
1define( 'GF_DEBUG', true );
Placement
This constant should be set in your wp-config.php. See the article Wp Config Options for more details.

gf_do_action()

gf_do_action()

DescriptionUsageParametersExamplesSinceSource Code

Description

Gravity Forms pre-processing for do_action.

Allows additional actions based on form and field ID to be defined easily.

Usage

1gf_do_action( array( 'my_action_hook', $form_id ), $arg1, $arg2 );

Parameters

$action arrayArray containing the action hook as well as the modifier.

Examples

1gf_do_action( array( 'my_action_hook', $form_id ), $arg1, $arg2 );

Since

This function was added in Gravity Forms version 1.9.12.

Source Code

This action hook is located in gravityforms.php

GF_Field_Address

GF_Field_Address

IntroductionSettings and PropertiesSettingsProperties$entry ValueUseful Methodsget_address_types()get_countries()get_country_code()get_country_codes()get_us_states()get_us_state_code()get_canadian_provinces()get_value_export()HooksSource Code

Introduction
The GF_Field_Address class extends the GF_Field class, also known as the Field Object. This class is responsible for determining how the Address field is rendered when the form is displayed and how its value is handled during and after form submission.
Settings and Properties
Settings control what options are available to the admin user when configuring the field in the form editor. Gravity Forms includes many built-in settings such as Field Label, Field Description, Choices, Conditional Logic, etc. In addition to built-in settings, custom settings can also be developed. For more information on how to develop custom settings and how to associate settings to a field, visit the GF_Field page.
Properties contain the values specified by the settings and generally are part of the Field Object.
The properties may be retrieved by accessing the Field Object as follows:
12345//get the field$field = GFFormsModel::get_field( $form, 1 ); //get the address type$address_type = $field->addressType;
Settings
The following settings are available for the field:

address_setting
Controls whether the group of Address field settings display. This group includes the 「Address Type」, custom sub-labels, ability to show/hide the individual field parts, 「Default Country」 (if International type is chosen), 「Default State」 (if United States is chosen), 「Default Province」 (if Canadian is chosen).

admin_label_setting
Controls whether the 「Admin Field Label」 setting appears.

conditional_logic_field_setting
Controls whether the 「Enable Conditional Logic」 setting appears.

copy_values_option
Controls whether the 「Display option to use the values submitted in different field」 setting displays. The option is used to determine whether the values from another address field on the form may be used for the current field. Example: Copying Billing Address to the Mailing Address field.

css_class_setting
Controls whether the 「Custom CSS Class」 setting displays. This allows a custom css to be used for the field.

default_input_values_setting
For complex fields like the name, time, address fields, this controls whether the 「Default Values」 section will appear which lets you set values for the individual components of the field. When it is not a complex field, the 「default_value_setting」 controls the display of this section.

description_setting
Controls whether the 「Description」 setting appears. This allows a description for the field to be displayed.

error_message_setting
Controls whether the 「Custom Validation Message」 setting which allows a custom message to be used appears.

input_placeholders_setting
For complex fields like the name, time, and address fields, this controls whether the 「Placeholders」 section will appear which lets you set placeholder text for the individual components of the field. When it is not a complex field, the 「placeholder_setting」 controls the display of this section.

label_setting
Controls whether the 「Field Label」 setting which allows the label to be changed appears.

prepopulate_field_setting
Controls whether the 「Allow field to be populated dynamically」 setting appears.

rules_setting
Controls whether the 「Rules」 settings section displays. The 「Required」 option shows when this is active.

sub_label_placement_setting
If a field has sub-labels, controls whether the 「Sub-Label Placement」 setting appears.

visibility_setting
Controls whether the 「Visibility」 setting displays. The controls whether the option of visibility being for 「Everyone」 or 「Admin Only」 can be set.

Properties
Below is a listing of the properties inherited from the parent class, and the properties unique to the field:

addressType string
The address type. This indicates the information/layout of the address. The available choices are 「international」, 「canadian」, and 「us」.

adminLabel string
The label to be used on admin pages instead of the label, useful for fields with long labels.

allowsPrepopulate boolean
Determines if the field values can be dynamically populated. Default is false.

conditionalLogic array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

copyValuesOptionDefault boolean
Determines whether the option to copy values is turned on or off by default.

copyValuesOptionField integer
The field id of the field being used as the copy source.

copyValuesOptionLabel string
The label that appears next to the copy values option when the form is displayed. The default value is 「Same as previous」.

defaultCountry string
The default country to be chosen in the Country drop down, if displayed. If the 「defaultValue」 property is set in the 「inputs」 array for the country input, the defaultValue will be used instead of this property. This is a legacy property that should no longer be used. Instead, use the 「defaultValue」 property of the 「inputs」 array.

defaultProvince string
The default province to be chosen in the Province drop down, if displayed. If the 「defaultValue」 property is set in the 「inputs」 array for the province input, the defaultValue will be used instead of this property. This is a legacy property that should no longer be used. Instead, use the 「defaultValue」 property of the 「inputs」 array.

defaultState string
The default state to be chosen in the State drop down, if displayed. If the 「defaultValue」 property is set in the 「inputs」 array for the state input, the defaultValue will be used instead of this property. This is a legacy property that should no longer be used. Instead, use the 「defaultValue」 property of the 「inputs」 array.

description string
The field description.

descriptionPlacement string
The placement of the field description. The description may be placed 「above」 or 「below」 the field inputs. If the placement is not specified, then the description placement setting for the Form Layout is used.

enableCopyValuesOption boolean
Indicates whether the copy values option can be used. This option allows users to skip filling out the field and use the same values as another. For example, if the mailing and billing address are the same.

errorMessage string
The custom error message to be displayed if the field fails validation.

formId integer
The form ID.

hideAddress2 boolean
Legacy property used to control whether the address2 input is visible. To hide the state, use the 「isHidden」 property of the 「inputs」 array instead.

hideCountry boolean
Legacy property used to control whether the country input is visible. To hide the state, use the 「isHidden」 property of the 「inputs」 array instead.

inputs array
An array containing the the individual properties for each element of the address field.

id integer
The id of the input field.

name string
The name of the parameter used for the input when dynamically populating the field.

label string
The label for the input.

customLabel string
The custom label for the input. When set, this is used in place of the label.

placeholder string
Placeholder text to give the user a hint on how to fill out the field. This is not submitted with the form.

defaultValue string
The default value to be displayed/chosen in the input field.

isHidden boolean
Controls whether the input is visible.

123456789101112131415161718192021222324252627282930313233343536373839404142434445$inputs = array(            array(              'id'           => '1.1',              'label'        => 'Street Address',              'customLabel'  => 'Custom Street',              'placeholder'  => 'Enter your street address',              'defaultValue' => '100 Main Street',              'isHidden'     => false            ),            array(              'id'          => '1.2',              'label'       => 'Address Line 2',              'customLabel' => 'Custom Street 2',              'placeholder' => 'Enter street 2',              'isHidden'    => true             ),            array(              'id'           => '1.3',              'label'        => 'City',              'customLabel'  => 'Custom City',              'placeholder'  => 'Enter your city',              'defaultValue' => 'Anywhere'            ),            array(              'id'           => '1.4',              'label'        => 'State / Province',              'customLabel'  => 'Custom State',              'placeholder'  => 'Enter your state',              'defaultValue' => 'Virginia'            ),            array(              'id'          => '1.5',              'label'       => 'ZIP / Postal Code',              'customLabel' => 'Custom Zip',              'placeholder' => 'Enter your zip'            ),            array(              'id'           => '1.6',              'label'        => 'Country',              'customLabel'  => 'Custom Country',              'placeholder'  => 'Select your country',              'defaultValue' => 'United States'            ),          )

hideState boolean
Legacy property used to control whether the state input is visible. To hide the state, use the 「isHidden」 property of the 「inputs」 array instead.

id integer
The field ID.

isRequired boolean
Marking the field as required will prevent the form from being submitted if the user does not enter a value. Default is false.

label string
The field label that will be displayed on the form and on the admin pages.

labelPlacement string
The placement of the main field label 「Address」. The choices are top-aligned (top_label), left-aligned (left_label), right-aligned (right_label). To control the sub-label placement of the fields within the address group, use the 「subLabelPlacement」 property.

subLabelPlacement string
The placement of the labels for the fields (street, city, zip/postal code, etc.) within the address group. This setting controls all of the address pieces, they cannot be set individually. They may be aligned above or below the inputs. If this property is not set, the 「Sub-Label Placement」 setting on the Form Settings->Form Layout page is used. If no setting is specified, the default is above inputs.

type string
The field type, which in this case is address.

$entry Value
The Address field is a multi-input field type with each input being saved separately in the Entry Object.
The key to each input value in the entry is the input id which is in the format {field_id}.{input_number}, so if the field ID is 5 here』s how you can access each input value:
1234567$field_id      = 5;$street_value  = rgar( $entry, $field_id . '.1' );$street2_value = rgar( $entry, $field_id . '.2' );$city_value    = rgar( $entry, $field_id . '.3' );$state_value   = rgar( $entry, $field_id . '.4' );$zip_value     = rgar( $entry, $field_id . '.5' );$country_value = rgar( $entry, $field_id . '.6' );
The get_value_export method can also be used to retrieve the entry values.
Useful Methods
GF_Field_Address inherits it』s available methods from GF_Field and overrides a few of them where necessary to provide its required appearance and functionality. Here are a few methods which can be useful when writing custom code.
get_address_types()
The get_address_types() method returns an array of address types for the current form.
Usage Example
1$address_types = $field->get_address_types( $form_id );

$form_id integer
The form ID.

Returns array
An array of the supported address types in the following format:

123456789101112131415161718192021$address_types = array(                   'international' => array(                                        'label'      => 'International',                                        'zip_label'  => 'ZIP / Postal Code',                                        'state_label => 'State / Province / Region'                                      ),                   'us'            => array(                                        'label'       => 'United States',                                        'zip_label'   => 'ZIP Code',                                        'state_label' => 'State',                                        'country'     => 'United States',                                        'states'      => array( '', 'Alabama', 'Alaska', 'Arizona' )                                      ),                   'canadian'      => array(                                        'label'       => 'Canadian',                                        'zip_label'   => 'Postal Code',                                        'state_label' => 'Province',                                        'country'     => 'Canada',                                        'states'      => array( '', 'Alberta', 'British Colombia', 'Manitoba' )                                      )                 );

get_countries()
The get_countries() method returns an array of countries.
Usage Example
1$countries = $field->get_countries();

Returns array
An array of country names in the following format:

1234567$countries = array(               'Afghanistan',               'Albania',               'Algeria',               'American Samoa',               'Zimbabwe'             );

get_country_code()
The get_country_code() method return the two character code for the specified country.
Usage Example
1$country_code = $field->get_country_code( $country_name );

$country_name string
The country name.

Returns string
The country code for the provided country name.

get_country_codes()
The get_country_codes() method returns an array of two character country codes.
Usage Example
1$country_codes = $field->get_country_codes();

Returns array
An array of the country name and its country code in the following format:

1234567$country_codes = array(                   'AFGHANISTAN'    => 'AF',                   'ALBANIA'        => 'AL',                   'ALGERIA'        => 'DZ',                   'AMERICAN SAMOA' => 'AS',                   'ZIMBABWE'       => 'ZW'                 );

get_us_states()
The get_us_states() method returns an array of US state names.
Usage Example
1$states = $field->get_us_states();

Returns array
An array of the US state names in the following format:

1234567$states = array(            'Alabama',            'Alaska',            'Arizona',            'Arkansas',            'Wyoming'          );

get_us_state_code()
The get_us_state_code() method returns the two character code for the specified state name.
Usage Example
1$state = $field->get_us_state_code( $state_name );

$state_name string
The state name.

Returns string
The two character code for the provided state name.

get_canadian_provinces()
The get_canadian_provinces() method returns an array of Canadian provinces.
Usage Example
1$provinces = $field->get_canadian_provinces();

Returns array
An array of the Canadian provinces in the following format:

1234567$provinces = array(               'Alberta',               'British Columbia',               'Manitoba',               'New Brunswick',               'Yukon'             );

get_value_export()
The get_value_export() method formats the entry value before it is used in entry exports and by framework add-ons that integrate with third-party services, however, you can use it in your custom code when interacting with the Form Object, Field Object and Entry Object.
Usage Examples
123456// if you have access to the $field object$value = $field->get_value_export( $entry ); // if you don't have access to the $field object you can get that first like so$field = GFFormsModel::get_field( $form, $field_id );$value = $field->get_value_export( $entry, $input_id );

$entry Entry Object
The entry from which the field value should be retrieved. Required.

$input_id string
The ID of the field for which the value should be retrieved. Required when not using $field. Defaults to the $field->id property when not supplied. To access the value of a specific input you can include the input number with the field id e.g *5.1** would return the value from the Street Address input for field 5.

Returns string
The values for the full field as a comma separated string or the value for a specific input.

Hooks
The following hooks are located in GF_Field_Address:

gform_address_display_format
gform_address_street
gform_address_street2
gform_address_zip
gform_address_city
gform_address_state
gform_address_country
gform_default_address_type
gform_address_types
gform_countries
gform_us_states
gform_disable_address_map_link

Source Code
The source code is located in includes/fields/class-gf-field-address.php in the Gravity Forms folder of your sites plugins directory.

GF_Field_Calculation

GF_Field_Calculation

IntroductionSettings and PropertiesSettingsPropertiesHooksSource Code

Introduction
The GF_Field_Calculation class extends the GF_Field class, also known as the Field Object. This class is responsible for determining how the Calculation type Product field is rendered when the form is displayed and how its value is handled during and after form submission.
Settings and Properties
Settings control what options are available to the admin user when configuring the field in the form editor. Gravity Forms includes many built-in settings such as Field Label, Field Description, Choices, Conditional Logic, etc. In addition to built-in settings, custom settings can also be developed. For more information on how to develop custom settings and how to associate settings to a field, visit the GF_Field page.
Properties contain the values specified by the settings and generally are part of the Field Object.
The properties may be retrieved by accessing the Field Object as follows:
12345//get the field$field = GFFormsModel::get_field( $form, 1 ); //get the formula$formula = $field->calculationFormula;
Settings
The following settings are available for the field:

calculation_setting
Determines whether the 「Formula」 section displays. This section allows a formula to be entered, merge tags to be used, and the formula entered to be validated.

conditional_logic_field_setting
Controls whether the 「Enable Conditional Logic」 setting appears.

disable_quantity_setting
Determines whether the 「Disable quantity field」 checkbox appears. This allows the quantity to be removed from the field. A default value of 1 will be used, unless a separate Quantity field is added.

duplicate_setting
Controls whether the 「No Duplicates」 setting displays within the 「Rules」 section. This controls whether the same value may exist more than once in the database. The 「Rules」 setting must be active for this to display.

rules_setting
Controls whether the 「Rules」 settings section displays. The 「Required」 option shows when this is active.

Properties
Below is a listing of the properties inherited from the parent class and ones specific to the field.

adminLabel string
The label to be used on admin pages instead of the label, useful for fields with long labels.

allowsPrepopulate boolean
Determines if the field values can be dynamically populated. Default is false.

calculationFormula string
The formula to be used to calculate the price.

conditionalLogic array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

cssClass string
The custom CSS class or classes to be added to the input tag for the field.

enableCalculation boolean
Indicates whether the calculation use is active.

description string
The field description.

descriptionPlacement string
The placement of the field description. The description may be placed 「above」 or 「below」 the field inputs. If the placement is not specified, then the description placement setting for the Form Layout is used.

disableQuantity boolean
Indicates whether the Quantity field is active.

formId integer
The form ID.

id integer
The field ID.

inputs array
An array containing the the individual properties for each element of the single product field.

id integer
The id of the input field.

label string
The label for the input.

name string
The name of the parameter used for the input when dynamically populating the field.

An example of the array output is as follows:
1234567891011121314151617$inputs = array(            array(              'id'    => '1.1',              'label' => 'Product Name',              'name'  => 'param_product'            ),            array(              'id'    => '1.2',              'label' => 'Price',              'name'  => 'param_price'            ),            array(              'id'    => '1.3',              'label' => 'Quantity',              'name'  => 'param_qty'            ),          )

inputType string
Specifies the sub-type of Product field being used. For instance, when the field is for a product, the 「type」 is set to product and the 「inputType」 is set to calculation. When the field is created, the type is initially set using the 「type」 property. If 「inputType」 is not empty, then the 「inputType」 is used to create the field instead.

isRequired boolean
Marking the field as required will prevent the form from being submitted if the user does not enter a value. Default is false.

label string
The field label that will be displayed on the form and on the admin pages.

noDuplicates boolean
Determines if the value entered by the user may already exist in the database.

type string
The field type, which in this case is product. The specific type of product field is in the 「inputType」 property.

Hooks
The following hooks are located in GF_Field_Calculation:

gform_product_quantity
gform_product_price

Source Code
The source code is located in includes/fields/class-gf-field-calculation.php in the Gravity Forms folder of your sites plugins directory.

GF_Field_CAPTCHA

GF_Field_CAPTCHA

IntroductionSettings and PropertiesSettingsPropertiesSource Code

Introduction
The GF_Field_CAPTCHA class extends the GF_Field class, also known as the Field Object. This class is responsible for determining how the CAPTCHA field is rendered when the form is displayed and how its value is handled during and after form submission.
Settings and Properties
Settings control what options are available to the admin user when configuring the field in the form editor. Gravity Forms includes many built-in settings such as Field Label, Field Description, Choices, Conditional Logic, etc. In addition to built-in settings, custom settings can also be developed. For more information on how to develop custom settings and how to associate settings to a field, visit the GF_Field page.
Properties contain the values specified by the settings and generally are part of the Field Object.
The properties may be retrieved by accessing the Field Object as follows:
12345//get the field$field = GFFormsModel::get_field( $form, 1 ); //get the captcha type$captcha_type = $field->captchaType;
Settings
The following settings are available for the field:

captcha_type_setting
Determines whether the 「Type」 section displays. If the plugin 「Really Simple Captcha」 is also installed, the type may be the default Google reCAPTCHA, Really Simple Captcha, or Math Challenge. The type drop down does not appear if this plugin is not available.

conditional_logic_field_setting
Controls whether the 「Enable Conditional Logic」 setting appears.

css_class_setting
Controls whether the 「Custom CSS Class」 setting displays. This allows a custom css to be used for the field.

description_setting
Controls whether the 「Description」 setting appears. This allows a description for the field to be displayed.

error_message_setting
Controls whether the 「Custom Validation Message」 setting which allows a custom message to be used appears.

label_setting
Controls whether the 「Field Label」 setting which allows the label to be changed appears.

Properties
Below is a listing of the properties inherited from the parent class, and the properties unique to the field:

adminLabel string
The label to be used on admin pages instead of the label, useful for fields with long labels.

captchaLanguage string
The language used when the captcha is displayed. This property is available when the captchaType is 「captcha」, the default. The possible values are the language codes used by WordPress.

captchaTheme string
The theme being used for the captcha. This property is available when the captchaType is 「captcha」, the default. The possibles values are 「light」 and 「dark」.

captchaType string
The captcha type being used. The default value will be 「captcha」 for Google』s reCAPTCHA. If the plugin 「Really Simple Captcha」 is installed, there are two other choices available, 「Really Simple Captcha」 with the value 「simple_captcha」 and 「Match Challenge」 with the value 「math」.

conditionalLogic array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

cssClass string
The custom CSS class or classes to be added to the input tag for the field.

description string
The field description.

descriptionPlacement string
The placement of the field description. The description may be placed 「above」 or 「below」 the field inputs. If the placement is not specified, then the description placement setting for the Form Layout is used.

errorMessage string
The custom error message to be displayed if the field fails validation.

formId integer
The form ID.

id integer
The field ID.

label string
The field label that will be displayed on the form and on the admin pages.

simpleCaptchaBackgroundColor string
The color of the background behind the text when the captcha is displayed. This property is available when the plugin Really Simple Captcha is installed and the captcha type is 「simple_captcha」 or 「math」. The color is represented using its HEX value.

simpleCaptchaFontColor string
The color of the font when the captcha is displayed. This property is available when the plugin Really Simple Captcha is installed and the captcha type is 「simple_captcha」 or 「math」. The color is represented using its HEX value.

simpleCaptchaSize string
The size of the captcha text that is displayed. This property is available when the plugin Really Simple Captcha is installed and the captcha type is 「simple_captcha」 or 「math」. The possible values are 「small」, 「medium」, 「large」.

type string
The field type, which in this case is captcha.

Source Code
The source code is located in includes/fields/class-gf-field-captcha.php in the Gravity Forms folder of your sites plugins directory.

GF_Field_Checkbox

GF_Field_Checkbox

IntroductionSettings and PropertiesSettingsPropertiesHooksSource Code

Introduction
The GF_Field_Checkbox class extends the GF_Field class, also known as the Field Object. This class is responsible for determining how the Checkbox field is rendered when the form is displayed and how its value is handled during and after form submission. This class also handles the Product Option field rendering when it is a checkbox.
Settings and Properties
Settings control what options are available to the admin user when configuring the field in the form editor. Gravity Forms includes many built-in settings such as Field Label, Field Description, Choices, Conditional Logic, etc. In addition to built-in settings, custom settings can also be developed. For more information on how to develop custom settings and how to associate settings to a field, visit the GF_Field page.
Properties contain the values specified by the settings and generally are part of the Field Object.
The properties may be retrieved by accessing the Field Object as follows:
12345//get the field$field = GFFormsModel::get_field( $form, 1 ); //get the admin label$admin_label = $field->adminLabel;
Settings
The following settings are available for the field:

admin_label_setting
Controls whether the 「Admin Field Label」 setting appears.

choices_setting
Determines whether the 「Choices」 setting displays. This section allows you to create different checkbox selections and set associated values to each one. It also allows you to choose from a pre-defined set of data that may be used to create the checkboxes. Without this section, the checkboxes are limited to 「First Choice」, 「Second Choice」 and 「Third Choice」 and may not be changed in the editor.

conditional_logic_field_setting
Controls whether the 「Enable Conditional Logic」 setting appears.

css_class_setting
Controls whether the 「Custom CSS Class」 setting displays. This allows a custom css to be used for the field.

description_setting
Controls whether the 「Description」 setting appears. This allows a description for the field to be displayed.

error_message_setting
Controls whether the 「Custom Validation Message」 setting which allows a custom message to be used appears.

label_setting
Controls whether the 「Field Label」 setting which allows the label to be changed appears.

prepopulate_field_setting
Controls whether the 「Allow field to be populated dynamically」 setting appears.

rules_setting
Controls whether the 「Rules」 settings section displays. The 「Required」 option shows when this is active.

visibility_setting
Controls whether the 「Visibility」 setting displays. The controls whether the option of visibility being for 「Everyone」 or 「Admin Only」 can be set.

Properties
Below is a listing of the properties inherited from the parent class and ones specific to the field:

adminLabel string
The label to be used on admin pages instead of the label, useful for fields with long labels.

adminOnly boolean
Determines whether the field is visible to the user submitting the form, or only visible in the admin.

allowsPrepopulate boolean
Determines if the field values can be dynamically populated. Default is false.

choices array
An array containing the the individual properties for each checkbox.

text string
The text that is displayed for the checkbox

value string
The value that is used for the checkbox when the form is submitted.

isSelected boolean
Indicates whether the checkbox is selected/checked

price string
Used when the checkbox is an 「option」 field belonging to a product and contains the item price.
1234567891011121314151617181920$choices = array(             array(               'text'       => 'First Choice',               'value'      => 'one',               'isSelected' => false,               'price'      => '$5.00' //only populated if a product option field             ),             array(               'text'       => 'Second Choice',               'value'      => 'two',               'isSelected' => true,               'price'      => ''             ),             array(               'text'       => 'Third Choice',               'value'      => 'three',               'isSelected' => false,               'price'      => ''             ),           );

conditionalLogic array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

cssClass string
The custom CSS class or classes to be added to the input tag for the field.

defaultValue string
The checkbox to be checked. This must match to a value for one of the items. This is only available when the checkbox is a product option field.

description string
The field description.

descriptionPlacement string
The placement of the field description. The description may be placed 「above」 or 「below」 the field inputs. If the placement is not specified, then the description placement setting for the Form Layout is used.

enableChoiceValue boolean
Indicates whether the 「show values」 option within the 「Choices」 section of the editor is checked.

enablePrice boolean
This property is used when the checkbox is a product option field and will be set to true. If not associated with a product, then it is false.

errorMessage string
The custom error message to be displayed if the field fails validation.

formId integer
The form ID.

id integer
The field ID.

inputName string
The parameter name used when dynamically populating the field.

inputs array
An array containing the the individual properties for each checkbox.

id integer
The id of the input field.

label string
The label for the input.
1234567891011121314$inputs = array(            array(              'id'    => '1.1',              'label' => 'First Choice',            ),            array(              'id'    => '1.2',              'label' => 'Second Choice',            ),            array(              'id'    => '1.3',              'label' => 'Third Choice',            ),          );

inputType string
Used when the field has a sub-type. For instance, when the checkbox is a product option field, then the 「type」 is set to 「option」 and the 「inputType」 is set to 「checkbox」. When the field is created, the type is initially set using the 「type」 property. If 「inputType」 is not empty, then the 「inputType」 is used to create the field instead.

isRequired boolean
Marking the field as required will prevent the form from being submitted if the user does not enter a value. Default is false.

label string
The field label that will be displayed on the form and on the admin pages.

productField integer
The id of the product field to which the checkbox is associated. This is used when the checkbox is an 「option」 associated with a product.

type string
The field type. It is normally 「checkbox」, unless the checkbox is a product field option, then the type is set to 「option」, with 「inputType」 being set to 「checkbox」.

Hooks
The following hooks are located in GF_Field_Checkbox:

gform_field_choice_markup_pre_render
gform_field_choices

Source Code
The source code is located in includes/fields/class-gf-field-checkbox.php in the Gravity Forms folder of your sites plugins directory.

GF_Field_Coupon

GF_Field_Coupon

IntroductionPropertiesDynamic PopulationCalculations SupportConditional Logic Support$entry ValueMerge TagsUseful Methodsget_value_export()Source Code

Introduction
The GF_Field_Coupon class extends the GF_Field class, also known as the Field Object, it』s responsible for determining how the Coupon field is rendered when the form is displayed and how it』s value is handled during and after submission.

Properties
These are the properties used by the Coupon field, which can be found in the Field Object, available to many of the hooks throughout Gravity Forms and some add-ons.

type string
The field type, which in this case is coupon.

id integer
The field ID.

label string
The field label that will be displayed on the form and on the admin pages.

adminLabel string
The label to be used on admin pages instead of the label, useful for fields with long labels.

isRequired boolean
Determines if the field requires the user to apply a coupon. Marking the field as required will prevent the form from being submitted if a coupon is not applied. Default is false.

errorMessage string
The custom error message to be displayed if the field fails validation.

placeholder string
The display only text to be used with the placeholder attribute of the input the user enters the coupon code into, it is not included in submissions.

formId integer
The ID of the form this field is located on.

pageNumber integer
The form page this field is located on. Default is 1.

conditionalLogic array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

description string
The field description.

cssClass string
The custom CSS class or classes to be added to the li tag that contains the field.

failed_validation boolean
Has the field failed validation. Default is false.

validation_message string
The error message to be displayed.

descriptionPlacement string
The field description position. Empty when using the form defaults, a value of 『below』 to position the description below the input container, or a value of 『above』 to position the description above the input container.

labelPlacement string
The field label visibility. Empty when using the form defaults or a value of 『hidden_label』.

allowsPrepopulate boolean
Determines in the field value can be dynamically populated. Default is false.

inputName string
The parameter name used when dynamically populating the field. Only used when allowsPrepopulate is true.

Dynamic Population
Since version 2.9.2 the Coupon field supports being dynamically populated with one or more coupon codes. Multiple codes should be passed as a string in the following format:
50OFF,25OFF
Calculations Support
Unfortunately the Coupon field can』t currently be used with calculations; we do have this on the feature request list.
Conditional Logic Support
The Coupon field is supported by conditional logic; you can configure conditional logic rules on other fields based on the code entered in the Coupon field.
$entry Value
The Coupon field stores the submitted coupon codes in the Entry Object as a string in the following format:
50OFF,25OFF
If you need to retrieve the entry value in a flexible way which would work with multiple forms where the Coupon field ID could be different we would recommend using the get_coupons_by_codes() method
Merge Tags
The field merge tag available via the merge tag drop down in notifications and confirmations will return the field entry value.
{[Field Label]:[field_id]} e.g. {Coupon:3}
The Coupon field does not have any modifiers for the field merge tag.
The {all_fields} merge tag will output the field entry value like any other field, however, the coupon codes will also be listed in the pricing summary table.

Useful Methods
GF_Field_Coupon inherits it』s available methods from GF_Field and overrides a few of them where necessary to provide its required appearance and functionality. Here are a few methods which can be useful when writing custom code.
get_value_export()
The get_value_export() method formats the entry value before it is used in entry exports and by framework add-ons that integrate with third-party services, however, you can use it in your custom code when interacting with the Form Object, Field Object and Entry Object.
Usage Examples
// if you don't have the $field object you can get it like so:
$field = GFAPI::get_field( $form_or_form_id, $field_id );

// if you have access to the $field object
$value = $field->get_value_export( $entry );

$entry Entry Object
The entry from which the field value should be retrieved. Required.

$input_id string
The ID of the field for which the value should be retrieved. Required when not using $field. Defaults to the $field->id property when not supplied.

Returns string
The entry value formatted as {couponName} ({couponCode}: {discount}). Multiple codes will be comma separated e.g.
$50 OFF (50OFF: -$50.00), 25% OFF (25OFF: -$12.50)

Source Code
The GF_Field_Coupon class is located in class-gf-field-coupon.php in the Gravity Forms Coupons Add-On folder of your sites plugins directory.
The GF_Field class is located in includes/fields/class-gf-field.php in the Gravity Forms folder of your sites plugins directory.

GF_Field_CreditCard

GF_Field_CreditCard

IntroductionSettings and PropertiesSettingsPropertiesHooksSource Code

Introduction
The GF_Field_CreditCard class extends the GF_Field class, also known as the Field Object. This class is responsible for determining how the Credit Card field is rendered when the form is displayed and how its value is handled during and after form submission.
Settings and Properties
Settings control what options are available to the admin user when configuring the field in the form editor. Gravity Forms includes many built-in settings such as Field Label, Field Description, Choices, Conditional Logic, etc. In addition to built-in settings, custom settings can also be developed. For more information on how to develop custom settings and how to associate settings to a field, visit the GF_Field page.
Properties contain the values specified by the settings and generally are part of the Field Object.
The properties may be retrieved by accessing the Field Object as follows:
12345//get the field$field = GFFormsModel::get_field( $form, 1 ); //get the credit card style$card_style = $field->creditCardStyle;
Settings
The following settings are available for the field:

admin_label_setting
Controls whether the 「Admin Field Label」 setting appears.

conditional_logic_field_setting
Controls whether the 「Enable Conditional Logic」 setting appears.

credit_card_setting
Controls whether the 「Supported Credit Cards」 section displays. This allows specific available credit cards to be selected for use.

credit_card_style_setting
Controls whether the 「Card Icon Style」 section displays. This allows the style of the credit card icons to be set to Standard or 3D.

css_class_setting
Controls whether the 「Custom CSS Class」 setting displays. This allows a custom css to be used for the field.

description_setting
Controls whether the 「Description」 setting appears. This allows a description for the field to be displayed.

error_message_setting
Controls whether the 「Custom Validation Message」 setting which allows a custom message to be used appears.

force_ssl_field_setting
Controls whether the 「Force SSL」 section displays. This allows the page to be forced to be secure when this field exists.

input_placeholders_setting
For complex fields like the credit card, name, time, and address fields, this controls whether the 「Placeholders」 section will appear which lets you set placeholder text for the individual components of the field. When it is not a complex field, the 「placeholder_setting」 controls the display of this section.

label_setting
Controls whether the 「Field Label」 setting which allows the label to be changed appears.

rules_setting
Controls whether the 「Rules」 settings section displays. The 「Required」 option shows when this is active.

sub_labels_setting
If a field has sub-labels, controls whether the setting to set them appears.

sub_label_placement_setting
If a field has sub-labels, controls whether the 「Sub-Label Placement」 setting appears.

Properties
Below is a listing of the properties inherited from the parent class, and the properties unique to the field.

adminLabel string
The label to be used on admin pages instead of the label, useful for fields with long labels.

conditionalLogic array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

creditCards array
An array of the available credit cards for selection.
123456$creditCards = array(                 'amex',                 'visa',                 'discover',                 'mastercard'               )

creditCardStyle string
The style of the credit card icon. The values are style1 (Standard) or style2 (3D).

cssClass string
The custom CSS class or classes to be added to the input tag for the field.

description string
The field description.

descriptionPlacement string
The placement of the field description. The description may be placed 「above」 or 「below」 the field inputs. If the placement is not specified, then the description placement setting for the Form Layout is used.

errorMessage string
The custom error message to be displayed if the field fails validation.

forceSSL boolean
Indicates whether the page the credit card field is on must be secure.

formId integer
The form ID.

id integer
The field ID.

inputs array
An array containing the the individual properties for each element of the credit card field.

id integer
The id of the input field.

label string
The label for the input.

customLabel string
The custom label for the input. When set, this is used in place of the label. The expiration month and year use one label and the custom label will be stored in the array with the data for the month.

defaultLabel string
This property is only used for the month, and specifies the default label that is used as the header for the Month/Year drop downs.

placeholder string
Placeholder text to give the user a hint on how to fill out the field. This is not submitted with the form.

123456789101112131415161718192021222324252627282930313233343536$inputs = array(            array(              'id'          => '1.1',              'label'       => 'Card Number',              'customLabel' => 'Number',              'placeholder' => 'Enter your credit card number',            ),            array(              'id'           => '1.2_month',              'label'        => 'Expiration Month',              'defaultLabel' => 'Expiration Date',              'customLabel'  => 'Expiry',              'placeholder'  => 'Enter the expiration month',            ),            array(              'id'          => '1.2_year',              'label'       => 'Expiration Year',              'placeholder' => 'Enter the expiration year',            ),            array(              'id'           => '1.3',              'label'        => 'Security Code',              'customLabel'  => 'CVV',              'placeholder'  => 'Enter your CVV',            ),            array(              'id'          => '1.4',              'label'       => 'Card Type',            ),            array(              'id'           => '1.5',              'label'        => 'Cardholder Name',              'customLabel'  => 'Name',              'placeholder'  => 'Enter your name as it appears on the card',    ),)

isRequired boolean
Marking the field as required will prevent the form from being submitted if the user does not enter a value. Default is false.

label string
The field label that will be displayed on the form and on the admin pages.

subLabelPlacement string
The placement of the labels for the fields (credit card number, expiration, security code, name) within the credit card group. This setting controls all of the credit card pieces, they cannot be set individually. They may be aligned above or below the inputs. If this property is not set, the 「Sub-Label Placement」 setting on the Form Settings->Form Layout page is used. If no setting is specified, the default is above inputs.

type string
The field type, which in this case is creditcard.

Hooks
The following hooks are located in GF_Field_CreditCard:

gform_payment_methods
gform_card_number
gform_card_expiration
gform_card_security_code
gform_card_name

Source Code
The source code is located in includes/fields/class-gf-field-creditcard.php in the Gravity Forms folder of your sites plugins directory.