Transforms all fields in the FieldList to use Bootstrap templates
@return FieldList
506322
public function bootstrapify() {		
		foreach($this->owner as $f) {

			$sng = Injector::inst()->get($f->class, true, ['dummy', '']);

			if(isset($this->ignores[$f->getName()])) continue;

            // if we have a CompositeField, bootstrapify its children
            if($f instanceof CompositeField) {
                $f->getChildren()->bootstrapify();
                continue;
            }

			// If we have a Tabset, bootstrapify all Tabs
			if($f instanceof TabSet) {
				$f->Tabs()->bootstrapify();
			}

			// If we have a Tab, bootstrapify all its Fields
			if($f instanceof Tab) {
				$f->Fields()->bootstrapify();
			}

			// If the user has customised the holder template already, don't apply the default one.
			if($sng->getFieldHolderTemplate() == $f->getFieldHolderTemplate()) {
				$template = "Bootstrap{$f->class}_holder";			
				if(SSViewer::hasTemplate($template)) {					
					$f->setFieldHolderTemplate($template);				
				}
				else {				
					$f->setFieldHolderTemplate("BootstrapFieldHolder");
				}

			}

			// If the user has customised the field template already, don't apply the default one.
			if($sng->getTemplate() == $f->getTemplate()) {
				foreach(array_reverse(ClassInfo::ancestry($f)) as $className) {						
					$bootstrapCandidate = "Bootstrap{$className}";
					$nativeCandidate = $className;
					if(SSViewer::hasTemplate($bootstrapCandidate)) {
						$f->setTemplate($bootstrapCandidate);
						break;
					}
					elseif(SSViewer::hasTemplate($nativeCandidate)) {
						$f->setTemplate($nativeCandidate);
						break;
					}


				}
			}
		}

		return $this->owner;		
	}
369196
public function getFieldList()
    {
        $fields = new FieldList();

        // tabbed or untabbed
        if ($this->tabbed) {
            $fields->push(new TabSet("Root", $mainTab = new Tab("Main")));
            $mainTab->setTitle(_t(__CLASS__ . '.TABMAIN', 'Main'));
        }

        // Add logical fields directly specified in db config
        foreach ($this->obj->config()->get('db') as $fieldName => $fieldType) {
            // Skip restricted fields
            if ($this->restrictFields && !in_array($fieldName, $this->restrictFields)) {
                continue;
            }

            // @todo Pass localized title
            if ($this->fieldClasses && isset($this->fieldClasses[$fieldName])) {
                $fieldClass = $this->fieldClasses[$fieldName];
                $fieldObject = new $fieldClass($fieldName);
            } else {
                $fieldObject = $this
                    ->obj
                    ->dbObject($fieldName)
                    ->scaffoldFormField(null, $this->getParamsArray());
            }
            // Allow fields to opt-out of scaffolding
            if (!$fieldObject) {
                continue;
            }
            $fieldObject->setTitle($this->obj->fieldLabel($fieldName));
            if ($this->tabbed) {
                $fields->addFieldToTab("Root.Main", $fieldObject);
            } else {
                $fields->push($fieldObject);
            }
        }

        // add has_one relation fields
        if ($this->obj->hasOne()) {
            foreach ($this->obj->hasOne() as $relationship => $component) {
                if ($this->restrictFields && !in_array($relationship, $this->restrictFields)) {
                    continue;
                }
                $fieldName = $component === 'SilverStripe\\ORM\\DataObject'
                    ? $relationship // Polymorphic has_one field is composite, so don't refer to ID subfield
                    : "{$relationship}ID";
                if ($this->fieldClasses && isset($this->fieldClasses[$fieldName])) {
                    $fieldClass = $this->fieldClasses[$fieldName];
                    $hasOneField = new $fieldClass($fieldName);
                } else {
                    $hasOneField = $this->obj->dbObject($fieldName)->scaffoldFormField(null, $this->getParamsArray());
                }
                if (empty($hasOneField)) {
                    continue; // Allow fields to opt out of scaffolding
                }
                $hasOneField->setTitle($this->obj->fieldLabel($relationship));
                if ($this->tabbed) {
                    $fields->addFieldToTab("Root.Main", $hasOneField);
                } else {
                    $fields->push($hasOneField);
                }
            }
        }

        // only add relational fields if an ID is present
        if ($this->obj->ID) {
            // add has_many relation fields
            if ($this->obj->hasMany()
                && ($this->includeRelations === true || isset($this->includeRelations['has_many']))
            ) {
                foreach ($this->obj->hasMany() as $relationship => $component) {
                    if ($this->tabbed) {
                        $fields->findOrMakeTab(
                            "Root.$relationship",
                            $this->obj->fieldLabel($relationship)
                        );
                    }
                    $fieldClass = (isset($this->fieldClasses[$relationship]))
                        ? $this->fieldClasses[$relationship]
                        : 'SilverStripe\\Forms\\GridField\\GridField';
                    /** @var GridField $grid */
                    $grid = Injector::inst()->create(
                        $fieldClass,
                        $relationship,
                        $this->obj->fieldLabel($relationship),
                        $this->obj->$relationship(),
                        GridFieldConfig_RelationEditor::create()
                    );
                    if ($this->tabbed) {
                        $fields->addFieldToTab("Root.$relationship", $grid);
                    } else {
                        $fields->push($grid);
                    }
                }
            }

            if ($this->obj->manyMany()
                && ($this->includeRelations === true || isset($this->includeRelations['many_many']))
            ) {
                foreach ($this->obj->manyMany() as $relationship => $component) {
                    static::addManyManyRelationshipFields(
                        $fields,
                        $relationship,
                        (isset($this->fieldClasses[$relationship]))
                            ? $this->fieldClasses[$relationship] : null,
                        $this->tabbed,
                        $this->obj
                    );
                }
            }
        }

        return $fields;
    }
866651
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Remove Field Objects:
        
        $fields->fieldByName('Root')->removeByName('Style');
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                CheckboxSetField::create(
                    'Areas',
                    $this->fieldLabel('Areas'),
                    AreaComponent::get()->map()
                )
            ]
        );
        
        // Insert Show On Field (within folder only):
        
        if ($this->getParent() instanceof PanelFolder) {
            
            $fields->insertAfter(
                SelectionGroup::create(
                    'ShowOn',
                    [
                        SelectionGroup_Item::create(
                            'AllPages',
                            null,
                            $this->fieldLabel('AllPages')
                        ),
                        SelectionGroup_Item::create(
                            'OnlyThesePages',
                            PageMultiselectField::create('Pages', ''),
                            $this->fieldLabel('OnlyThesePages')
                        )
                    ]
                )->setTitle($this->fieldLabel('ShowOn')),
                'Areas'
            );
            
        }
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'PanelOptions',
                $this->fieldLabel('PanelOptions'),
                [
                    CheckboxField::create(
                        'DoNotInherit',
                        $this->fieldLabel('DoNotInherit')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
110449
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                TextField::create(
                    'Label',
                    $this->fieldLabel('Label')
                ),
                FontIconField::create(
                    'ButtonIcon',
                    $this->fieldLabel('ButtonIcon')
                )
            ]
        );
        
        // Create Style Fields:
        
        $fields->addFieldToTab(
            'Root.Style',
            FieldSection::create(
                'ScrollToTopStyle',
                $this->fieldLabel('ScrollToTopStyle'),
                [
                    ViewportsField::create(
                        'ButtonSize',
                        $this->fieldLabel('ButtonSize')
                    )->setUseTextInput(true),
                    ViewportsField::create(
                        'IconSize',
                        $this->fieldLabel('IconSize')
                    )->setUseTextInput(true)
                ]
            )
        );
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'ScrollToTopOptions',
                $this->fieldLabel('ScrollToTopOptions'),
                [
                    NumericField::create(
                        'OffsetShow',
                        $this->fieldLabel('OffsetShow')
                    ),
                    NumericField::create(
                        'OffsetOpacity',
                        $this->fieldLabel('OffsetOpacity')
                    ),
                    NumericField::create(
                        'ScrollDuration',
                        $this->fieldLabel('ScrollDuration')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
870765
public function getCMSFields()
    {
        $fields = $this->scaffoldFormFields(
            array(
                // Don't allow has_many/many_many relationship editing before the record is first saved
                'includeRelations' => ($this->ID > 0),
                'tabbed' => true,
                'ajaxSafe' => true
            )
        );
        $fields->removeByName('PresetID');
        $fields->addFieldToTab(
            'Root.Main',
            ReadonlyField::create(
                'PresetName',
                _t('PlaceableObject.PRESET', 'Preset')
            )->setValue($this->Preset()->Title)
        );
        $this->extend('updateCMSFields', $fields);
        return $fields;
    }
283058
protected function getFieldsToUpdate()
    {
        $toUpdate = array();

        $fields     = $this->_item->getFields();
        $origFields = $this->_item->getOrigFields();
        foreach ($fields as $field => $value) {
            if (! array_key_exists($field, $origFields) or $value != $origFields[$field]) {
                $toUpdate[$field] = $value;
            }
        }

        return $toUpdate;
    }
990236
protected function getFormFields()
    {
        $manyFields = $this->getManyFields();
        $formFields = [];
        foreach ($this->definition->getEditableFieldNames() as $field) {
            if (!in_array($field, $manyFields)) {
                $formFields[] = $field;
            }
        }
        return $formFields;
    }
79782
public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->addFieldsToTab(
            "Root.Main",
            array(
                TextareaField::create(
                    'Title'
                )->setRows(1),
                HTMLEditorField::create(
                    'Content'
                )
            )
        );

        $this->extend('updateCMSFields', $fields);

        return $fields;
    }
324409
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Field Objects:
        
        $fields->fieldByName('Root.Options.TitleOptions')->push(
            CheckboxField::create(
                'UseLevelTitle',
                $this->fieldLabel('UseLevelTitle')
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
509674
public function getCMSFields()
    {
        $fields = $this->scaffoldFormFields(
            array(
                // Don't allow has_many/many_many relationship editing before the record is first saved
                'includeRelations' => ($this->ID > 0),
                'tabbed' => true,
                'ajaxSafe' => true
            )
        );
        $fields->removeByName(
            array(
                'Title',
                'Instance',
                'Style',
                'Objects'
            )
        );
        if (!$this->IsMain) {
            $fields->addFieldsToTab(
                'Root.Main',
                array(
                    TextField::create(
                        'Title',
                        _t('PlaceableObject_Preset.TITLE', 'Title')
                    ),
                    DropdownField::create(
                        'Instance',
                        _t('PlaceableObject_Preset.INSTANCE', 'Instance'),
                        singleton('PlaceableObject_Preset')->dbObject('Instance')->enumValues()
                    )
                )
            );
        }
        if ($this->Styles) {
            $fields->addFieldToTab(
                'Root.Main',
                DropdownField::create(
                    'Style',
                    _t('PlaceableObject_Preset.STYLE', 'Style'),
                    $this->Styles
                )->setEmptyString(_t('PlaceableObject_Preset.DEFAULTSTYLE', 'Default'))
            );
        }
        $fields->addFieldsToTab(
            'Root.Objects',
            array(
                LabelField::create(
                    'ObjectsDescription',
                    _t('PlaceableObject_Preset.OBJECTSDESCRIPTION', 'List of all objects that use this use this preset.')
                ),
                GridField::create(
                    'Objects',
                    _t('PlaceableObject_Preset.OBJECTS', 'Objects'),
                    $this->Objects(),
                    GridFieldConfig_Base::create()
                )
            )
        );
        $this->extend('updateCMSFields', $fields);
        return $fields;
    }
75089
public function getCMSFields()
    {
        // Obtain Field Objects (from parent):
        
        $fields = parent::getCMSFields();
        
        // Create Style Fields:
        
        $style = [];
        
        // Create Column Span Field:
        
        if (self::framework()->useColumnSpan()) {
            
            $style[] = ViewportsField::create(
                'Span',
                $this->fieldLabel('Span'),
                $this->getColumnSpanOptions()
            );
            
        }
        
        // Create Column Offset Field:
        
        if (self::framework()->useColumnOffset()) {
            
            $style[] = ViewportsField::create(
                'Offset',
                $this->fieldLabel('Offset'),
                $this->getColumnOffsetOptions()
            );
            
        }
        
        // Add Style Fields to Tab:
        
        if (!empty($style)) {
            
            $fields->addFieldToTab(
                'Root.Style',
                FieldSection::create(
                    'ColumnStyle',
                    $this->fieldLabel('ColumnStyle'),
                    $style
                )
            );
            
        }
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'ColumnOptions',
                $this->fieldLabel('ColumnOptions'),
                [
                    CheckboxField::create(
                        'Sidebar',
                        $this->fieldLabel('Sidebar')
                    ),
                    CheckboxField::create(
                        'HideEmpty',
                        $this->fieldLabel('HideEmpty')
                    ),
                    CheckboxField::create(
                        'EdgeToEdge',
                        $this->fieldLabel('EdgeToEdge')
                    )
                ]
            )
        );
        
        // Answer Field Objects:
        
        return $fields;
    }
634727
public function HiddenFields()
    {
        $hiddenFields = new FieldList();
        $dataFields = $this->dataFields();

        if ($dataFields) {
            foreach ($dataFields as $field) {
                if ($field instanceof HiddenField) {
                    $hiddenFields->push($field);
                }
            }
        }

        return $hiddenFields;
    }
482631
public function toArray()
    {
        $fieldValues = [];
        foreach ($this->fieldsets as $fieldset) {
            $fieldValues = array_merge($fieldValues, $fieldset->toArray());
        }
        return $fieldValues;
    }
29093
public function getProcessedFields()
    {
        $fields = array();
        foreach ($this->fields as $fieldName => $field) {
            $fields[$fieldName] = $this->getProcessedField($fieldName);
        }

        return $fields;
    }
6136
public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        if (!$this->isAllowedChildren()) {
            return $fields;
        }
        $fields->addFieldsToTab(
            'Root.' . _t(__CLASS__ . '.CHILDREN', 'Children'),
            [
                GridField::create(
                    'Children',
                    _t(__CLASS__ . '.CHILDREN', 'Children'),
                    $this->Children(),
                    GridFieldConfig_RecordEditor::create()
                        ->addComponent(new GridFieldOrderableRows())
                )
            ]
        );

        return $fields;
    }
230811
public function dataFields()
    {
        if (empty($this->sequentialSet)) {
            $fields = [];
            $this->recursiveWalk(function (FormField $field) use (&$fields) {
                if (!$field->hasData()) {
                    return;
                }
                $name = $field->getName();
                if (isset($fields[$name])) {
                    $this->fieldNameError($field, __FUNCTION__);
                }
                $fields[$name] = $field;
            });
            $this->sequentialSet = $fields;
        }
        return $this->sequentialSet;
    }
646716
public function getAllFields()
    {
        $fields = [];
        foreach ($this->fields as $group) {
            foreach ($group as $field) {
                $fields[$field->getName()] = $field;
            }
        }
        return $fields;
    }