FormBuilderField class

Located in file /site/modules/FormBuilder/FormBuilderField.php

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

Show class?             Show args?        

Common

NameReturnSummary 
add(FormBuilderField $child)
$thisAdd a new child to this form/field 
allFields()
array FormBuilderField nullCheck if field present in allFields or add field to it 
child(string $name)
FormBuilderField nullReturn the direct child given by $name 
children()
arrayReturn array of all children
Can also be used as property: children
 
columnWidth int 
defaultValue string 
description string 
fbForm()
FormBuilderForm null@return FormBuilderForm|null 
find(string $name)
FormBuilderField nullRecursively find the field named $name (alias of getFieldByName) 
findAll()
arrayGet contents of the self::$allFields property containing all addded fields at runtime 
form FormBuilderForm 
formName string 
get(string $key)
mixedGet a value from this form field 
getArray()
arrayReturn an array representing this field and children (when present) 
getChildrenFlat()
arrayReturn a flattened (non structured) array of all children 
getDefaultsArray()
arrayGet default settings for a blank FormBuilderField object 
getFieldByName(string $name)
FormBuilderField nullGet a field by name, within entire form 
getInputfield()
InputfieldGet new Inputfield for this FormBuilderField (for public API usage) 
getSetting(string $key)
mixed nullGet a setting only, no fallback to getting field by name 
head string 
label string 
level int 
name string 
notes string 
numChildren int 
parent FormBuilderField null 
prevParent FormBuilderField null Temporary property used after field is removed only 
remove($key)
FormBuilderData thisRemove the given child from this form/field 
required bool 
requiredIf string 
set(string $key, mixed $value)
FormBuilderData thisSet a value to the field 
setArray(array $data)
(nothing)Given an array of data, populate the data to this form field 
setName(string $name)
FormBuilderDataSet field name 
showIf string 
type string 

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.244

“…building with ProcessWire was a breeze, I really love all the flexibility the system provides. I can’t imagine using any other CMS in the future.” —Thomas Aull