Manages all custom fields in ProcessWire

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

Common / Advanced / For hooks

Show “$fields”             Show Arguments        

Common

NameReturnSummary 
$fields->clone($item)
bool or SaveableCreate and return a cloned copy of the given Field
$fields->delete($item)
boolDelete a Field from the database
$fields->get($key)
Field or nullGet a field by name or id
$fields->getNumPages(Field $field)
int or arrayReturn a count of pages containing populated values for the given field
$fields->getNumRows(Field $field)
int or arrayReturn a count of database rows populated the given field
$fields->isNative(string $name)
boolIs the given field name native/permanent to the database?
$fields->save($item)
boolSave a Field to the database

Advanced

NameReturnSummary 
$fields->saveFieldgroupContext(Field $field, Fieldgroup $fieldgroup)
boolSave the context of the given field for the given fieldgroup

For hooks

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

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.66