$forms API variable / FormBuilder class

Create or edit forms and manage submitted entries.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the FormBuilder class also inherits all the methods and properties of: WireData and Wire.

Show $var?             Show args?        

Common

NameReturnSummary 
$forms->addNew(string $formName)
FormBuilderFormAdd a new form with the given name
$forms->akismetKey string 
$forms->count()
(nothing)Return number of forms here, per Countable interface 
$forms->countEntries($id)
intReturn the number of entries for the given form ID 
$forms->csvDelimiter string Delimeter to use for CSV files 
$forms->csvUseBOM bool Include a UTF-8 BOM at the beginning of CSV files? 
$forms->delete(FormBuilderForm $form)
boolDelete the given $form
$forms->embed($formName)
stringGet the embed code for a given form 
$forms->embedCode string 
$forms->embedFields array Fields allowed for easy-embed 
$forms->embedTag string Easy embed tag 
$forms->entryToForm($entry)
bool FormBuilderFormGiven an entry array or ID return the FormBuilderForm object that it belongs to 
$forms->exportJSON($form)
stringReturn the JSON schema for the given form ID 
$forms->filesPath string Path for file attachments 
$forms->findEntries(string $keywords)
arrayFind form entries across all forms (or on specific form if specified) 
$forms->finished()
(nothing)Called when request has finished 
$forms->form($form)
FormBuilderFormConvert given value to FormBuilderForm if it isn’t already 
$forms->formID($formID)
intConvert given value to form ID if is isn’t already 
$forms->formLog($form, string $str)
WireLogRecord a log entry for FormBuilder 
$forms->formName($formName)
intConvert given value to form name if is isn’t already 
$forms->forms()
FormBuilderMainPlaceholder function for FormBuilderMain variable to ensure it's only instantiated when needed 
$forms->frameworksPath()
stringReturn the path where frameworks are stored 
$forms->frameworksURL()
stringReturn the URL where frameworks are stored 
$forms->fromEmail string Default from email for sent emails 
$forms->get(string $key)
mixedRetrieve a config variable or a form, depending on the key 
$forms->getEmbedVersion()
stringReturns a form embed key for matching request to response 
$forms->getEntry(int $entryID)
array boolGet a form entry by ID 
$forms->getFileFromKey(string $key)
bool stringRetrieve a filename from a transportable key 
$forms->getFileKey($formID, int $entryID, string $filename)
bool stringGenerate a transportable key for the given filename within a form and entry 
$forms->getFileURL($formID, int $entryID, string $filename)
bool stringReturn a URL where the given file can be viewed 
$forms->getFilesPath()
stringReturn path that FormBuilder uses for storing files
$forms->getFormName($id)
stringGet the name of a form 
$forms->getFormNames()
array stringGet names of all forms (indexed by form ID) 
$forms->getFramework(FormBuilderForm $form)
FormBuilderFramework nullGet the framework used by the given $form 
$forms->getFromURL()
FormBuilderForm FormBuilderRender stringLoad form from URL (for embed method a or b) 
$forms->getHelpers(string $for)
arrayRetrieve all themes or frameworks files 
$forms->getIterator()
ArrayObjectMake this module iterable, as required by the IteratorAggregate interface 
$forms->getTemplateVersion()
intGet the template version set from form-builder.php 
$forms->hasPermission(string $name, $form)
boolCheck if the current user has the permission name for the given $form 
$forms->helperPath(string $for)
stringGet path for 'themes' or 'frameworks' helpers 
$forms->importJSON($form, string $json)
boolImport to form ID the given JSON schema 
$forms->inputfieldClasses array Inputfield classes allowed for form fields 
$forms->isForm($id)
boolGiven a form ID or name, returns true if is used by a form, false if not 
$forms->isReservedName(string $name)
boolReturns whether or not the given $name may be used or a form or field name 
$forms->isValidLicense()
(nothing) 
$forms->lastMaint int Timestamp of the last time maintenance was performed 
$forms->licenseKey string  
$forms->load($id)
FormBuilderForm array nullRetrieve a form by $id, $name or specify boolean true to return all forms
$forms->loadAll()
arrayLoad all forms 
$forms->loadHooksFile()
(nothing)Load the optional /site/templates/form-builder.inc hooks file 
$forms->mailer string WireMail mailer to use for sending email, 'WireMail' to force native PHP mail(), or blank for auto-detect.  
$forms->maintenance()
NumberPerform form maintenance on all forms (or a specific form, if given) 
$forms->render($form)
FormBuilderRenderRender a form directly (embed method C)
$forms->save(FormBuilderForm $form)
boolSave the given $form
$forms->saveEntry(array $entry)
bool intSave a form entry 
$forms->setTemplateVersion(int $version)
(nothing)Set the form-builder.php template version, to be called from form-builder.php 
$forms->themesPath()
stringReturn the path where themes are stored 
$forms->themesURL()
stringReturn the URL where themes are stored 
$forms->upgrade($fromVersion, $toVersion)
(nothing)
$forms->useRoles int bool Enable access control? 
$forms->viewFile(string $key)
(nothing)Outputs the given file, must be located under getFilesPath() 
$forms->wired()
(nothing)Wired to API 

Additional methods and properties

In addition to the methods and properties above, FormBuilder also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.172

Twitter updates

  • ProcessWire 3.0.174 core updates: improvements to the new path/URL hooks and more— More
    12 March 2021
  • ProcessWire 3.0.173 adds several new requested features and this post focuses on one of my favorites: the ability to hook into and handle ProcessWire URLs, independent of pages— More
    5 March 2021
  • This week ProcessWire gained powerful new tools for finding pages and controlling how they are loaded. If you like to maximize performance and efficiency, you’ll like what 3.0.172 brings— More
    5 February 2021

Latest news

  • ProcessWire Weekly #356
    In the 356th issue of ProcessWire Weekly we'll cover the latest core updates (ProcessWire 3.0.173), introduce new third party modules RockCalculator and RockIframe, and take a closer look at a brand new site of the week. Read on!
    Weekly.pw / 6 March 2021
  • ProcessWire 3.0.173 core updates: New URL hooks
    ProcessWire 3.0.173 adds several new requested features and this post focuses on one of my favorites: the ability to hook into and handle ProcessWire URLs, independent of pages.
    Blog / 5 March 2021
  • Subscribe to weekly ProcessWire news

“We chose ProcessWire because of its excellent architecture, modular extensibility and the internal API. The CMS offers the necessary flexibility and performance for such a complex website like superbude.de. ProcessWire offers options that are only available for larger systems, such as Drupal, and allows a much slimmer development process.” —xport communication GmbH