$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.236

Latest news

  • ProcessWire Weekly #553
    In the 553rd issue of ProcessWire Weekly we'll check out the latest weekly update from Ryan, introduce a new third party module called Text Synthesis, and more. Read on!
    Weekly.pw / 14 December 2024
  • Custom Fields Module
    This week we look at a new ProFields module named Custom Fields. This module provides a way to rapidly build out ProcessWire fields that contain any number of subfields/properties within them.
    Blog / 30 August 2024
  • 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