$fieldgroups API variable / Fieldgroups class

Maintains collections of Fieldgroup object instances and represents the `$fieldgroups` API variable.

For full details on all methods available in a Fieldgroup, be sure to also see the WireArray class.


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

Show $var?             Show args?        

Common

NameReturnSummary 
$fieldgroups->clone(Saveable $item)
Fieldgroup falseCreate and return a cloned copy of this item
$fieldgroups->delete($item)
boolDelete the given fieldgroup from the database
$fieldgroups->deleteField(Field $field)
boolDelete the entries in fieldgroups_fields for the given Field 
$fieldgroups->getAll()
FieldgroupsArrayPer WireSaveableItems interface, return all available Fieldgroup instances 
$fieldgroups->getExportData(Fieldgroup $fieldgroup)
arrayExport config data for the given fieldgroup
$fieldgroups->getFieldNames($fieldgroup)
arrayGet all field names used by given fieldgroup 
$fieldgroups->getLookupTable()
stringPer WireSaveableItemsLookup interface, return the name of the table that Fields are linked to Fieldgroups 
$fieldgroups->getNumTemplates(Fieldgroup $fieldgroup)
intGet the number of templates using the given fieldgroup. 
$fieldgroups->getTable()
stringPer WireSaveableItems interface, return the name of the table that Fieldgroup instances are stored in 
$fieldgroups->getTemplates(Fieldgroup $fieldgroup)
TemplatesArrayGiven a Fieldgroup, return a TemplatesArray of all templates using the Fieldgroup 
$fieldgroups->getWireArray()
WireArray FieldgroupsArray@return WireArray|FieldgroupsArray 
$fieldgroups->init()
(nothing)Init 
$fieldgroups->makeBlankItem()
FieldgroupPer WireSaveableItems interface, create a blank instance of a Fieldgroup 
$fieldgroups->save(Saveable $item)
boolSave the Fieldgroup to DB
$fieldgroups->saveContext(Fieldgroup $fieldgroup)
intSave contexts for all fields in the given fieldgroup
$fieldgroups->setImportData(Fieldgroup $fieldgroup, array $data)
arrayGiven an export data array, import it back to the class and return what happened

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, Fieldgroups also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.244

Latest news

  • ProcessWire Weekly #558
    In the 558th issue of ProcessWire Weekly we'll check out the blog post that introduces ProcessWire 3.0.244, share some recent ProcessWire highlights, and more. Read on!
    Weekly.pw / 18 January 2025
  • ProcessWire 3.0.244 new main/master version
    ProcessWire 3.0.244 is our newest main/master/stable version. It's been more than a year in the making and is packed with tons of new features, issue fixes, optimizations and more. This post covers all the details.
    Blog / 18 January 2025
  • Subscribe to weekly ProcessWire news

“The end client and designer love the ease at which they can update the website. Training beyond how to log in wasn’t even necessary since ProcessWire’s default interface is straightforward.” —Jonathan Lahijani