function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Text', array(new ReadonlyField('Readonly', 'ReadonlyField'), new TextareaField('Textarea', 'TextareaField - 8 rows', 8), new TextField('Text', 'TextField'), new HtmlEditorField('HTMLField', 'HtmlEditorField'), new EmailField('Email', 'EmailField'), new PasswordField('Password', 'PasswordField'), new AjaxUniqueTextField('AjaxUniqueText', 'AjaxUniqueTextField', 'AjaxUniqueText', 'BasicFieldsTestPage')));
     $fields->addFieldsToTab('Root.Numeric', array(new NumericField('Number', 'NumericField'), new CurrencyField('Price', 'CurrencyField'), new PhoneNumberField('PhoneNumber', 'PhoneNumberField'), new CreditCardField('CreditCard', 'CreditCardField')));
     $fields->addFieldsToTab('Root.Option', array(new CheckboxField('Checkbox', 'CheckboxField'), new CheckboxSetField('CheckboxSet', 'CheckboxSetField', TestCategory::map()), new DropdownField('DropdownID', 'DropdownField', TestCategory::map()), new GroupedDropdownField('GroupedDropdownID', 'GroupedDropdown', array('Test Categorys' => TestCategory::map())), new ListboxField('ListboxFieldID', 'ListboxField', TestCategory::map(), array(), 3), new OptionsetField('OptionSetID', 'OptionSetField', TestCategory::map())));
     // All these date/time fields generally have issues saving directly in the CMS
     $fields->addFieldsToTab('Root.DateTime', array($calendarDateField = new DateField('CalendarDate', 'DateField with calendar'), new DateField('Date', 'DateField'), $dmyDateField = new DateField('DMYDate', 'DateField with separate fields'), new TimeField('Time', 'TimeField'), $timeFieldDropdown = new TimeField('TimeDropdown', 'TimeField with dropdown'), new DatetimeField('DateTime', 'DateTime'), $dateTimeShowCalendar = new DatetimeField('DateTimeWithCalendar', 'DateTime with calendar')));
     $calendarDateField->setConfig('showcalendar', true);
     $dmyDateField->setConfig('dmyfields', true);
     $timeFieldDropdown->setConfig('showdropdown', true);
     $dateTimeShowCalendar->getDateField()->setConfig('showcalendar', true);
     $dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
     $fields->addFieldsToTab('Root.File', array(UploadField::create('File', 'FileUploadField'), UploadField::create('Image', 'ImageUploadField'), UploadField::create('HasManyFiles', 'HasManyFilesUploadField'), UploadField::create('ManyManyFiles', 'ManyManyFilesUploadField')));
     $tabs = array('Root.Text', 'Root.Numeric', 'Root.Option', 'Root.DateTime', 'Root.File');
     foreach ($tabs as $tab) {
         $tabObj = $fields->fieldByName($tab);
         foreach ($tabObj->FieldList() as $field) {
             $disabledField = $field->performDisabledTransformation();
             $disabledField->setTitle($disabledField->Title() . ' (disabled)');
             $disabledField->setName($disabledField->getName() . '_disabled');
             $tabObj->insertAfter($disabledField, $field->getName());
             $readonlyField = $field->performReadonlyTransformation();
             $readonlyField->setTitle($readonlyField->Title() . ' (readonly)');
             $readonlyField->setName($readonlyField->getName() . '_readonly');
             $tabObj->insertAfter($readonlyField, $field->getName());
         }
     }
     $fields->addFieldToTab('Root.Text', new TextField('Text_NoLabel', false, 'TextField without label'), 'Text_disabled');
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab("Root.CheckboxSet", new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
     $fields->addFieldsToTab('Root.Tree', array(TreeDropdownField::create('HasOnePage', 'HasOnePage', 'SiteTree'), TreeMultiselectField::create('HasManyPages', 'HasManyPages', 'SiteTree'), TreeMultiselectField::create('ManyManyPages', 'ManyManyPages (with search)', 'SiteTree')->setShowSearch(true)));
     //		$fields->addFieldToTab("Root.Tests.ComplexTableField",
     //			new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
     //		$fields->addFieldToTab("Root.Tests.CheckboxSet", new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $description = 'This is <strong>bold</strong> help text';
     $fields->addFieldsToTab('Root.Text', array(Object::create('TextField', 'Required', 'Required field'), Object::create('TextField', 'Validated', 'Validated field (checks range between 1 and 3)'), Object::create('ReadonlyField', 'Readonly', 'ReadonlyField'), Object::create('TextareaField', 'Textarea', 'TextareaField - 8 rows')->setRows(8), Object::create('TextField', 'Text', 'TextField'), Object::create('HtmlEditorField', 'HTMLField', 'HtmlEditorField'), Object::create('EmailField', 'Email', 'EmailField'), Object::create('PasswordField', 'Password', 'PasswordField')));
     $fields->addFieldsToTab('Root.Numeric', array(Object::create('NumericField', 'Number', 'NumericField'), Object::create('CurrencyField', 'Price', 'CurrencyField'), Object::create('MoneyField', 'Money', 'MoneyField', array('Amount' => 99.98999999999999, 'Currency' => 'EUR')), Object::create('PhoneNumberField', 'PhoneNumber', 'PhoneNumberField'), Object::create('CreditCardField', 'CreditCard', 'CreditCardField')));
     $fields->addFieldsToTab('Root.Option', array(Object::create('CheckboxField', 'Checkbox', 'CheckboxField'), Object::create('CheckboxSetField', 'CheckboxSet', 'CheckboxSetField', TestCategory::map()), Object::create('DropdownField', 'DropdownID', 'DropdownField', TestCategory::map())->setHasEmptyDefault(true), Object::create('GroupedDropdownField', 'GroupedDropdownID', 'GroupedDropdown', array('Test Categorys' => TestCategory::map())), Object::create('ListboxField', 'ListboxFieldID', 'ListboxField', TestCategory::map())->setSize(3), Object::create('ListboxField', 'MultipleListboxFieldID', 'ListboxField (multiple)', TestCategory::map())->setMultiple(true)->setSize(3), Object::create('OptionsetField', 'OptionSet', 'OptionSetField', TestCategory::map()), Object::create('ToggleCompositeField', 'ToggleCompositeField', 'ToggleCompositeField', new FieldList(Object::create('TextField', 'ToggleCompositeTextField1'), Object::create('TextField', 'ToggleCompositeTextField2'), Object::create('DropdownField', 'ToggleCompositeDropdownField', 'ToggleCompositeDropdownField', TestCategory::map()), Object::create('TextField', 'ToggleCompositeTextField3')))));
     // All these date/time fields generally have issues saving directly in the CMS
     $fields->addFieldsToTab('Root.DateTime', array($calendarDateField = Object::create('DateField', 'CalendarDate', 'DateField with calendar'), Object::create('DateField', 'Date', 'DateField'), $dmyDateField = Object::create('DateField', 'DMYDate', 'DateField with separate fields'), Object::create('TimeField', 'Time', 'TimeField'), $timeFieldDropdown = Object::create('TimeField', 'TimeWithDropdown', 'TimeField with dropdown'), Object::create('DatetimeField', 'DateTime', 'DateTime'), $dateTimeShowCalendar = Object::create('DatetimeField', 'DateTimeWithCalendar', 'DateTime with calendar')));
     $calendarDateField->setConfig('showcalendar', true);
     $dmyDateField->setConfig('dmyfields', true);
     $timeFieldDropdown->setConfig('showdropdown', true);
     $dateTimeShowCalendar->getDateField()->setConfig('showcalendar', true);
     $dateTimeShowCalendar->getTimeField()->setConfig('showdropdown', true);
     $fields->addFieldsToTab('Root.File', array($bla = UploadField::create('File', 'FileUploadField')->setDescription($description)->setConfig('allowedMaxFileNumber', 1)->setConfig('canPreviewFolder', false), UploadField::create('AttachedFile', 'UploadField with canUpload=false')->setDescription($description)->setConfig('canUpload', false), UploadField::create('Image', 'UploadField for image')->setDescription($description), UploadField::create('HasManyFiles', 'UploadField for has_many')->setDescription($description), UploadField::create('ManyManyFiles', 'UploadField for many_many')->setDescription($description)));
     $data = $this->getDefaultData();
     foreach ($fields->dataFields() as $field) {
         $name = $field->getName();
         if (isset($data[$name])) {
             $field->setValue($data[$name]);
         }
     }
     $blacklist = array('DMYDate', 'Required', 'Validated', 'ToggleCompositeField');
     $tabs = array('Root.Text', 'Root.Numeric', 'Root.Option', 'Root.DateTime', 'Root.File');
     foreach ($tabs as $tab) {
         $tabObj = $fields->fieldByName($tab);
         foreach ($tabObj->FieldList() as $field) {
             $field->setDescription($description);
             // ->addExtraClass('cms-description-tooltip');
             if (in_array($field->getName(), $blacklist)) {
                 continue;
             }
             $disabledField = $field->performDisabledTransformation();
             $disabledField->setTitle($disabledField->Title() . ' (disabled)');
             $disabledField->setName($disabledField->getName() . '_disabled');
             $tabObj->insertAfter($disabledField, $field->getName());
             $readonlyField = $field->performReadonlyTransformation();
             $readonlyField->setTitle($readonlyField->Title() . ' (readonly)');
             $readonlyField->setName($readonlyField->getName() . '_readonly');
             $tabObj->insertAfter($readonlyField, $field->getName());
         }
     }
     $noLabelField = new TextField('Text_NoLabel', false, 'TextField without label');
     $noLabelField->setDescription($description);
     $fields->addFieldToTab('Root.Text', $noLabelField, 'Text_disabled');
     $fields->addFieldToTab('Root.Text', FieldGroup::create(TextField::create('MyFieldGroup1'), TextField::create('MyFieldGroup2'), DropdownField::create('MyFieldGroup3', false, TestCategory::map())));
     $fields->addFieldToTab('Root.Text', FieldGroup::create('MyLabelledFieldGroup', array(TextField::create('MyLabelledFieldGroup1'), TextField::create('MyLabelledFieldGroup2'), DropdownField::create('MyLabelledFieldGroup3', null, TestCategory::map())))->setTitle('My Labelled Field Group'));
     return $fields;
 }
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $allFields = array();
     $checkboxFields = array(new CheckboxSetField("CheckboxSet", "CheckboxSetField", TestCategory::map()));
     $fields->addFieldsToTab("Root.CheckboxSet", $checkboxFields);
     $allFields += $checkboxFields;
     $treeFields = array(TreeDropdownField::create('HasOnePageID', 'HasOnePage', 'SiteTree'), TreeDropdownField::create('HasOnePageWithSearchID', 'HasOnePageWithSearch', 'SiteTree')->setShowSearch(true), TreeMultiselectField::create('HasManyPages', 'HasManyPages', 'SiteTree'), TreeMultiselectField::create('ManyManyPages', 'ManyManyPages (with search)', 'SiteTree')->setShowSearch(true));
     $fields->addFieldsToTab('Root.Tree', $treeFields);
     $allFields += $treeFields;
     foreach ($allFields as $field) {
         $field->setDescription('This is <strong>bold</strong> help text')->addExtraClass('cms-help');
         // ->addExtraClass('cms-help cms-help-tooltip');
     }
     return $fields;
 }