GF_Field_HTML

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:

SettingDescription
conditional_logic_field_settingAllows conditional logic to be enabled for the field and the individual rules to be defined.
content_settingAllows the user to enter HTML or text to be displayed for the field.
css_class_settingAllows custom CSS class names to be added to the field container.
disable_margins_settingAllows the content margins to be set to align the content with other fields.
label_settingAllows 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.

ParameterTypeDescription
conditionalLogicarrayAn associative array containing the conditional logic rules. See the Conditional Logic Object for more details.
contentstringThe HTML/text that displays for the field.
cssClassstringThe custom CSS class or classes to be added to the input tag for the field.
disableMarginsbooleanIndicates whether the default margins are turned on to align the HTML content with other fields.
displayOnlybooleanIndicates the field is only displayed and its contents are not submitted with the form/saved with the entry. This is set to true.
formIdintegerThe form ID.
idintegerThe field ID.
labelstringThe field label that will be displayed on the form and on the admin pages.
typestringThe 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.