Syntactic sugar for SilverStripe FieldLists

Installs: 19 095

Dependents: 1

Suggesters: 0

Security: 0

Stars: 28

Watchers: 6

Forks: 4

Open Issues: 6


1.0.2 2014-05-19 21:47 UTC

This package is auto-updated.

Last update: 2022-11-22 10:00:48 UTC


Syntactic sugar for your SilverStripe FieldLists.

Basic Usage


Is syntactic sugar for:

$fields->addFieldToTab("Root.Main", TextField::create("FirstName", "First Name"),"Content");
$fields->addFieldToTab("Root.Main", TextField::create("Age", "Age"),"Content");

In FieldLists with TabSets, the tab is assumed to be "Root.Main", unless otherwise specified. Labels are automatically generated from field names when not provided. Wildcard field methods are any subclass of FormField, with the "Field" suffix removed, and with a lowercase first letter. Examples:

  • text() -> TextField
  • currency() -> CurrencyField
  • treeDropdown() -> TreeDropdownField

Specifying tabs

    ->grid("Qualifications","Qualifications", $this->Qualifications(), GridFieldConfig_RecordEditor::create());

Mutating fields after instantiation

For chainability, each method returns the FieldList, so in order to access the FormField object, you must use the configure() accessor, followed by end() to return to the FieldList object.

      ->setSource(array('1' => 'One', '2' => 'Two'))
      ->setEmptyString("-- None --")

Is syntactic sugar for:

$fields->addFieldToTab("Root.Main", DropdownField::create("PickOne","Pick One")
  ->setSource(array('1' => 'One', '2' => 'Two'))
  ->setEmptyString("-- None --")
$fields->addFieldToTab("Root.Main", TextField::create("Title"));

Grouping fields

You can instantiate a FieldGroup with the group() method.


Is syntactic sugar for:

$fields->addFieldToTab("Root.Main", TextField::create("Name"));
$fields->addFieldToTab("Root.Main", FieldGroup::create(


There are a few shortcut methods for adding common field configurations.

  ->hasManyGrid("RelatedObjects","Related objects", $this->RelatedObjects())