IntroductionUsagePropertiesBasic PropertiesPost RelatedForm SubmissionAdvanced PropertiesForm JSON
Introduction
The Form object is the main object in Gravity Forms. It contains all properties of a particular form (i.e. form title, fields, notification, scheduling, etc…). This object is available to most of the Gravity Forms hooks.
It is formatted as an associative array (i.e. $form[『title』] retrieves the form title).
Usage
12$form['title'] //returns the form title$form['fields'][0]['type']; //returns the type of the first field of the form
Properties
Basic Properties
id integer
The form Id.
title string
The form title
description string
The form description
labelPlacement string
Determines if the field labels are displayed on top of the fields (top_label), besides the fields and aligned to the left (left_label) or besides the fields and aligned to the right (right_label)
Possible values: top_label, left_label, right_label
descriptionPlacement string
Determines if the field description is displayed above the field input (i.e. immediately after the field label) or below the field input.
Possible values: above, below
Note: This setting is only available when labelPlacement is set to 「top_label」. When labelPlacement is not 「top_label」, this setting will always be set to 「below」.
Field Object array
List of all fields that belong to the form
Post Related
useCurrentUserAsAuthor bool
For forms with Post fields, this determines if the post should be created using the current logged in user as the author. 1 to use the current user, 0 otherwise.
postAuthor integer
When useCurrentUserAsAuthor is set to 0, this property contains the user Id that will be used as the Post author.
postCategory integer
Form forms with Post fields, but without a Post Category field, this property determines the default category that the post will be associated with when created.
postContentTemplate string
Template to be used when creating the post content. Field variables (i.e. {Name:3} ) can be added to the template to insert user submitted values into the post content. Only applicable when postContentTemplateEnabled is true
postContentTemplateEnabled bool
Determines if the post template functionality is enabled. When enabled, the post content will be created based on the template specified by postContentTemplate.
postFormat string
For forms with Post fields, determines the format that the Post should be created with.
Possible values: Will vary depending on the formats supported by the current theme.
postStatus string
For forms with Post fields, determines the status that the Post should be created with.
Possible values: draft, pending, publish
postTitleTemplate string
Template to be used when creating the post title. Field variables (i.e. {Name:3} ) can be added to the template to insert user submitted values into the post title. Only applicable when postTitleTemplateEnabled is true
postTitleTemplateEnabled bool
Determines if the post title template functionality is enabled. When enabled, the post title will be created based on the template specified by postTitleTemplate.
Form Submission
confirmation array
Contains the form confirmation settings such as confirmation text or redirect URL
notifications Notifications Object
An associative array containing the properties for all the email notifications which exist for a form.
Advanced Properties
Button array
Contains the form button settings such as the button text or image button source.
cssClass string
Custom CSS class. This class will be added to the