ModelForms module

Form

A model in the Forms module, with 45 members for templates, 27 API properties and 53 members for admin templates.

View
What Smarty and Twig templates receive. Properties in REST API responses and job payloads. What admin screen templates receive when you override them.

Templates view

Properties 31

Take no arguments.

# __toString() Templates only
string
Returns the rendered HTML when the model is used in a string context.
# getAvailableLayouts()
Collection
Get the available layouts for showing forms
# getCurrentSubmission()
?FormSubmission
Get the current form submission
# hasFileInput()
bool
Returns whether form has InputFile at any step. This method can be used to decide whether to add enctype="multipart/form-data" to form.
# getSteps()
?Collection
Get the steps for the active revision of the form. Returns null if the form does not have an active revision.
# getElements()
?Collection
Get the elements for the active revision of the form. Returns null if the form does not have an active revision.
# getSubmissionsCount()
int
Get the number of submissions for this form
# getAssignedWorkflow()
?Workflow
Get the workflow assigned to the record or entity
# hasAssignedWorkflow()
bool
Check whether the record has an assigned workflow
# getBranches()
Collection
Get the branches associated with the record
# getNumRevisionsWithoutBranch()
int
Get the number of revisions without branch
# getId()
?int
# getName()
?string
# getIdentifier()
?string
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getPublished()
?DateTime
# getSite()
?Site
# getActiveRevision()
?FormRevision
# isPublished()
bool
Determines if the record is published.
# getRevisions()
?Collection<FormRevision>
# getLastRevision()
?Model
# getCustomFieldValues()
?Collection<FormCustomFieldValue>
# getCustomFields()
array
Get the custom fields for this entity
# getExternalId()
?string
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned
# getHtml() Templates only
string
Gets the rendered HTML for the record using its layout template.
# getCurrentStep() Templates only
?Step
Get the step to be rendered for the form, depending on the current state of the submission.
# getIdPrefix() Templates only
string
Returns the prefix that is applied to the ids for any elements of this form

Methods 14

Take arguments. The API serialises only getters that need none.

# setIdPrefix(string $prefix) Templates only
void
Sets the prefix that should be applied to the ids for any elements of this form
# getBranchRevisions(RevisionBranch $branch, ?int $limit, ?int $offset)
Collection
Get the revisions for the provided branch, ordered by id ascending. Pass a limit/offset to fetch a bounded window instead of the full set — loading all revisions of a large branch exhausts memory.
# getNumBranchRevisions(RevisionBranch $branch)
int
Get the number of revisions for the provided branch (COUNT query — does not hydrate)
# getRevisionsWithoutBranch(?int $limit, ?int $offset)
Collection
Get the revisions without branch, ordered by id ascending. Pass a limit/offset to fetch a bounded window instead of the full set — loading all revisions of a record with a large history exhausts memory.
# getRevisionById(int $id)
?Model
# getCustomFieldValue(CustomField $customField)
?CustomFieldValue
Get the value for a custom field
# getCustomFieldValueByName(string $customFieldName)
?CustomFieldValue
Get the value for a custom field by the custom field name
# getCustomFieldContent(string $customFieldName)
?Content
Get the content for the custom field identified by the specified name
# getCustomFieldContentOrDefault(string $customFieldName)
?Content
Get the (default) content for the custom field identified by the specified name
# getCustomFieldBoolean(string $customFieldName, ?bool $default)
?bool
Get the (default) content of the custom field as boolean value
# getCustomFieldText(string $customFieldName, ?string $default)
?string
Get the (default) content of the custom field as text
# getCustomFieldImage(string $customFieldName)
?Image
Get the (default) image contained in the custom field
# getCustomFieldFile(string $customFieldName)
?File
Get the (default) file contained in the custom field
# hasCustomField(string $customFieldName)
bool
Check if the entity has a custom field with the specified name

API & Jobs view

API & JobsEach property is a key in REST API responses and job payloads. Its name is the template getter without get, is or has. Methods that need arguments are not available here.

Properties 27

Read-only values on the record.

# availableLayouts
Collection
Get the available layouts for showing forms
# currentSubmission
?FormSubmission
Get the current form submission
# fileInput
bool
Returns whether form has InputFile at any step. This method can be used to decide whether to add enctype="multipart/form-data" to form.
# steps
?Collection
Get the steps for the active revision of the form. Returns null if the form does not have an active revision.
# elements
?Collection
Get the elements for the active revision of the form. Returns null if the form does not have an active revision.
# submissionsCount
int
Get the number of submissions for this form
# assignedWorkflow
?Workflow
Get the workflow assigned to the record or entity
# assignedWorkflow
bool
Check whether the record has an assigned workflow
# branches
Collection
Get the branches associated with the record
# numRevisionsWithoutBranch
int
Get the number of revisions without branch
# id
?int
# name
?string
# identifier
?string
# created
?DateTime
Date the record was created.
# modified
?DateTime
Last modification date for the record.
# published
?DateTime
# site
?Site
# activeRevision
?FormRevision
# published
bool
Determines if the record is published.
# revisions
?Collection<FormRevision>
# lastRevision
?Model
# customFieldValues
?Collection<FormCustomFieldValue>
# customFieldContent
object
Get a serialized representation of the custom fields associated with the record
# customFields
array
Get the custom fields for this entity
# externalId
?string
# pendingPaymentRedirectUrl API & Jobs only
?string
Returns a redirect URL if payment processing requires a browser redirect.
# pendingPaymentSdkConfig API & Jobs only
?array
Returns SDK configuration when payment processing requires an in-page button (e.g. PayPal Donate SDK). Null when payment completed synchronously or via redirect.

Admin view

AdminAvailable in cdna-admin templates. Copy an admin template into your site repository to change how this record is edited.

Properties 37

Take no arguments.

# getAvailableLayouts()
Collection
Get the available layouts for showing forms
# getCurrentSubmission()
?FormSubmission
Get the current form submission
# hasFileInput()
bool
Returns whether form has InputFile at any step. This method can be used to decide whether to add enctype="multipart/form-data" to form.
# getSteps()
?Collection
Get the steps for the active revision of the form. Returns null if the form does not have an active revision.
# getElements()
?Collection
Get the elements for the active revision of the form. Returns null if the form does not have an active revision.
# getSubmissionsCount()
int
Get the number of submissions for this form
# isSupportingBranches() Admin only
bool
Checks whether the record supports branches
# getAssignedWorkflow()
?Workflow
Get the workflow assigned to the record or entity
# hasAssignedWorkflow()
bool
Check whether the record has an assigned workflow
# getBranches()
Collection
Get the branches associated with the record
# getNumRevisionsWithoutBranch()
int
Get the number of revisions without branch
# getId()
?int
# getName()
?string
# getIdentifier()
?string
# getCreated()
?DateTime
Date the record was created.
# getModified()
?DateTime
Last modification date for the record.
# getPublished()
?DateTime
# getSite()
?Site
# getActiveRevision()
?FormRevision
# isPublished()
bool
Determines if the record is published.
# getRevisions()
?Collection<FormRevision>
# getLastRevision()
?Model
# getCustomFieldValues()
?Collection<FormCustomFieldValue>
# getCustomFields()
array
Get the custom fields for this entity
# getExternalId()
?string
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned
# getUniqueInputElements() Admin only
Collection
Returns unique by name input elements of this model. Returns all elements through all revisions.
# getEditUrl() Admin only
?string
Get the url for editing the record.
# getDeleteUrl() Admin only
?string
Get the url for deleting the record.
# getDuplicateUrl() Admin only
?string
Get the url for duplicating the record.
# getPermissionsUrl() Admin only
?string
Get the url for editing the permissions of the record.
# getCheckPermissionsUrl() Admin only
?string
Get the url for checking user permissions for this record.
# getPublishUrl() Admin only
?string
Get the url for publishing the record.
# getAvailableSaveNewActions() Admin only
array
Get the actions available for saving a new version of the record. Determined whether an active revision can be set directly, and in which order the actions should be returned.

Methods 16

Take arguments. The API serialises only getters that need none.

# getBranchRevisions(RevisionBranch $branch, ?int $limit, ?int $offset)
Collection
Get the revisions for the provided branch, ordered by id ascending. Pass a limit/offset to fetch a bounded window instead of the full set — loading all revisions of a large branch exhausts memory.
# getNumBranchRevisions(RevisionBranch $branch)
int
Get the number of revisions for the provided branch (COUNT query — does not hydrate)
# getRevisionsWithoutBranch(?int $limit, ?int $offset)
Collection
Get the revisions without branch, ordered by id ascending. Pass a limit/offset to fetch a bounded window instead of the full set — loading all revisions of a record with a large history exhausts memory.
# getRevisionById(int $id)
?Model
# getCustomFieldValue(CustomField $customField)
?CustomFieldValue
Get the value for a custom field
# getCustomFieldValueByName(string $customFieldName)
?CustomFieldValue
Get the value for a custom field by the custom field name
# getCustomFieldContent(string $customFieldName)
?Content
Get the content for the custom field identified by the specified name
# getCustomFieldContentOrDefault(string $customFieldName)
?Content
Get the (default) content for the custom field identified by the specified name
# getCustomFieldBoolean(string $customFieldName, ?bool $default)
?bool
Get the (default) content of the custom field as boolean value
# getCustomFieldText(string $customFieldName, ?string $default)
?string
Get the (default) content of the custom field as text
# getCustomFieldImage(string $customFieldName)
?Image
Get the (default) image contained in the custom field
# getCustomFieldFile(string $customFieldName)
?File
Get the (default) file contained in the custom field
# hasCustomField(string $customFieldName)
bool
Check if the entity has a custom field with the specified name
# getAvailableSaveActions(?Model $currentRevision) Admin only
array
Get the save actions available for the record and provided revision being edited
# getRevisionActions(Revision $revision, ?Revision $currentRevision) Admin only
array
Get the actions available for the provided revision
# getUpdateRevisionId(Revision $revision) Admin only
?int
Get the revision ID to use when updating the record. If the provided revision is a draft, the previous id is returned, if one exists.