Introduction
The GF_Field_HTML class extends the GF_Field class, also known as the Field Object. This class is responsible for determining how the HTML 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:
//get the field
$field = GFFormsModel::get_field( $form, 1 );
//get the html content
$content = $field->content;
Settings
The following settings are available for the field:
| Setting | Description |
|---|---|
conditional_logic_field_setting | Allows conditional logic to be enabled for the field and the individual rules to be defined. |
content_setting | Allows the user to enter HTML or text to be displayed for the field. |
css_class_setting | Allows custom CSS class names to be added to the field container. |
disable_margins_setting | Allows the content margins to be set to align the content with other fields. |
label_setting | Allows the user to define a label for the field. |
Properties
Below is a listing of the properties inherited from the parent class and ones specific to the field.
| Parameter | Type | Description |
|---|---|---|
conditionalLogic | array | An associative array containing the conditional logic rules. See the Conditional Logic Object for more details. |
content | string | The HTML/text that displays for the field. |
cssClass | string | The custom CSS class or classes to be added to the input tag for the field. |
disableMargins | boolean | Indicates whether the default margins are turned on to align the HTML content with other fields. |
displayOnly | boolean | Indicates the field is only displayed and its contents are not submitted with the form/saved with the entry. This is set to true. |
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. |
type | string | The field type. This is set to “html”. |
$entry Value
The HTML field is a display only field so does not save a value in the entry.
Hooks
There are no hooks located in GF_Field_HTML.
Source Code
The source code is located in includes/fields/class-gf-field-html.php in the Gravity Forms folder of your sites plugins directory.