Manages all custom fields in ProcessWire, independently of any Fieldgroup.
Each field returned is an object of type Field
. The $fields API variable is iterable:
foreach($fields as $field) {
echo "<p>Name: $field->name, Type: $field->type, Label: $field->label</p>";
}
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
Name | Return | Summary | |
---|---|---|---|
$fields->getTags() $fields->getTags() $fields->getTags($getFieldNames = false) | array | Get list of all tags used by fields | |
$fields->saveFieldgroupContext() $fields->saveFieldgroupContext(Field $field, Fieldgroup $fieldgroup) $fields->saveFieldgroupContext(Field $field, Fieldgroup $fieldgroup, string $namespace = '') | bool | Save 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.
Name | Return | Summary | |
---|---|---|---|
$fields->changeFieldtype() $fields->changeFieldtype(Field $field1) $fields->changeFieldtype(Field $field1, bool $keepSettings = false) | bool | Change a field's type | |
$fields->changeTypeReady() $fields->changeTypeReady($item, Fieldtype $fromType, Fieldtype $toType) $fields->changeTypeReady($item, Fieldtype $fromType, Fieldtype $toType) | (nothing) | Hook called right before a field is about to change type | |
$fields->changedType() $fields->changedType($item, Fieldtype $fromType, Fieldtype $toType) $fields->changedType($item, Fieldtype $fromType, Fieldtype $toType) | (nothing) | Hook called when a field has changed type | |
$fields->deleteFieldDataByTemplate() $fields->deleteFieldDataByTemplate(Field $field, Template $template) $fields->deleteFieldDataByTemplate(Field $field, Template $template) | bool | Physically delete all field data (from the database) used by pages of a given template |
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.236