InputfieldWrapper class

A type of Inputfield that contains other Inputfield objects as children. Commonly a form or a fieldset.

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

Show class?     Show args?       Only hookable?    

Manipulation

NameReturnSummary 
add($item)
Inputfield InputfieldWrapper thisAdd an Inputfield item as a child (also accepts array definition) 
append(Inputfield $item)
$thisAppend an Inputfield to this instance’s children. 
import($items)
$thisImport the given Inputfield items as children 
importArray(array $a)
$thisImport an array of Inputfield definitions to to this InputfieldWrapper instance 
insert($item, $existingItem)
$thisInsert new or existing Inputfield before or after another 
insertAfter($item, $existingItem)
$thisInsert one Inputfield after one that’s already there. 
insertBefore($item, $existingItem)
$thisInsert one Inputfield before one that’s already there. 
new(string $typeName)
Inputfield InputfieldSelect InputfieldWrapperCreate a new Inputfield, add it to this InputfieldWrapper, and return the new Inputfield
populateValues($data)
arrayPopulate values for all Inputfields in this wrapper from the given $data object or array. 
prepend(Inputfield $item)
$thisPrepend an Inputfield to this instance’s children. 
remove($key)
$thisRemove an Inputfield from this instance’s children. 

Retrieval and traversal

NameReturnSummary 
child()
Inputfield nullFind an Inputfield below this one that has the given name 
children()
InputfieldsArrayReturn all children Inputfield objects
Can also be used as property: children
 
count()
intReturn the quantity of children present 
find(string $selector)
InputfieldsArrayFind all children Inputfields matching a selector string 
get(string $key)
Inputfield mixedGet a child Inputfield having a name attribute matching the given $key. 
getAll()
InputfieldsArrayGet all Inputfields below this recursively in a flat InputfieldWrapper (children, and their children, etc.) 
getByAttr(string $attrName, string $attrValue)
Inputfield InputfieldWrapper nullGiven an attribute name and value, return the first matching Inputfield or null if not found 
getByField($field)
Inputfield InputfieldWrapper nullGet Inputfield by Field (hasField) 
getByName(string $name)
Inputfield InputfieldWrapper nullShorter alias of getChildByName() 
getByProperty(string $property, mixed $value)
Inputfield InputfieldWrapper null arrayGet Inputfield by some other non-attribute property or setting 
getChildByName(string $name)
Inputfield InputfieldWrapper nullGiven an Inputfield name, return the child Inputfield or NULL if not found. 
getIterator()
InputfieldsArrayEnables foreach() of the children of this class 
isEmpty()
boolReturns true if all children are empty, or false if one or more is populated 

For hooks

These methods are only useful for hooking and should not be called directly.

Errors

NameReturnSummary 
getErrorInputfields()
array InputfieldGet Inputfield objects that have errors 
getErrors()
arrayReturn an array of errors that occurred on any of the children during input processing. 

Properties

Access any common Inputfield type class name from an InputfieldWrapper and it will return a new instance of that Inputfield, i.e. $f = $inputfields->InputfieldText; Below are several examples.

NameReturnSummaryDefault
InputfieldAsmSelect InputfieldAsmSelect Create new asmSelect Inputfield  
InputfieldButton InputfieldButton Create new button Inputfield  
InputfieldCKEditor InputfieldCKEditor Create new CKEditor Inputfield  
InputfieldCheckbox InputfieldCheckbox Create new checkbox Inputfield  
InputfieldCheckboxes InputfieldCheckboxes Create new checkboxes Inputfield  
InputfieldDatetime InputfieldDatetime Create new date/time Inputfield  
InputfieldEmail InputfieldEmail Create new email Inputfield  
InputfieldFieldset InputfieldFieldset Create new Fieldset InputfieldWrapper  
InputfieldFile InputfieldFile Create new file Inputfield  
InputfieldFloat InputfieldFloat Create new float Inputfield  
InputfieldForm InputfieldForm Create new form InputfieldWrapper  
InputfieldHidden InputfieldHidden Create new hidden Inputfield  
InputfieldIcon InputfieldIcon Create new icon Inputfield  
InputfieldImage InputfieldImage Create new image Inputfield  
InputfieldInteger InputfieldInteger Create new integer Inputfield  
InputfieldMarkup InputfieldMarkup Create new markup Inputfield  
InputfieldPage InputfieldPage Create new Page selection Inputfield  
InputfieldPageAutocomplete InputfieldPageAutocomplete Create new Page selection autocomplete Inputfield  
InputfieldPageListSelect InputfieldPageListSelect Create new PageListSelect Inputfield  
InputfieldPageListSelectMultiple InputfieldPageListSelectMultiple Create new multiple PageListSelect Inputfield  
InputfieldRadios InputfieldRadios Create new radio buttons Inputfield  
InputfieldSelect InputfieldSelect Create new <select> Inputfield  
InputfieldSelectMultiple InputfieldSelectMultiple Create new <select multiple> Inputfield  
InputfieldSubmit InputfieldSubmit Create new submit button Inputfield  
InputfieldText InputfieldText Create new single-line text Inputfield  
InputfieldTextTags InputfieldTextTags Create new text tags Inputfield  
InputfieldTextarea InputfieldTextarea Create new multi-line <textarea> Inputfield  
InputfieldToggle InputfieldToggle Create new toggle Inputfield  
InputfieldURL InputfieldURL Create new URL Inputfield  
InputfieldWrapper InputfieldWrapper Create new generic InputfieldWrapper  

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.251