Update Fields
@return FieldList
348601
public function updateCMSFields(FieldList $fields)
    {
        $fields->addFieldsToTab(
            'Root.Main',
            array(
                TextField::create(
                    'GoogleTagManager',
                    _t(__CLASS__ . '.ID', 'Tag manager ID')
                )
                ->setAttribute(
                    "placeholder",
                    "GTM-******"
                ),
            )
        );
        return $fields;
    }
973819
public function updateCMSFields(FieldList $fields)
    {
        $fields->addFieldsToTab(
            'Root.Meta',
            array(
                UploadField::create('MetaImageCustom', 'Default Meta Image'),
                GridField::create(
                    'ContactPoints',
                    _t('SiteConfig.CONTACTPOINTS', 'Contact points'),
                    $this->owner->ContactPoints(),
                    GridFieldConfig_RecordEditor::create()
                ),
                GridField::create(
                    'LocalBusiness',
                    _t('SiteConfig.LOCALBUSINESS', 'Local business'),
                    $this->owner->LocalBusiness(),
                    GridFieldConfig_RecordEditor::create()
                )
            )
        );
        return $fields;
    }
959107
def updated_current_fields(
            self,
            update_fields):
        
        self.fields_to_add = {}
        for k in self.org_fields:
            self.fields_to_add[k] = self.org_fields[k]
        self.fields_to_add.update(update_fields)
483515
public function updateCMSFields(FieldList $fields)
    {
        // Update Field Objects (from parent):
        
        parent::updateCMSFields($fields);
        
        // Create Google Tab:
        
        $fields->findOrMakeTab(
            'Root.SilverWare.Services.Google',
            $this->owner->fieldLabel('Google')
        );
        
        // Define Placeholders:
        
        $placeholderAuto = _t(__CLASS__ . '.DROPDOWNAUTOMATIC', 'Automatic');
        
        // Create Field Objects:
        
        $fields->addFieldsToTab(
            'Root.SilverWare.Services.Google',
            [
                FieldSection::create(
                    'GoogleAPIConfig',
                    $this->owner->fieldLabel('GoogleAPIConfig'),
                    [
                        TextField::create(
                            'GoogleAPIKey',
                            $this->owner->fieldLabel('GoogleAPIKey')
                        )->setRightTitle(
                            _t(
                                __CLASS__ . '.GOOGLEAPIKEYRIGHTTITLE',
                                'Create credentials using the Google API Manager and paste the API key here.'
                            )
                        ),
                        DropdownField::create(
                            'GoogleAPILanguage',
                            $this->owner->fieldLabel('GoogleAPILanguage'),
                            $this->owner->getGoogleLanguageOptions()
                        )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholderAuto)
                    ]
                ),
                FieldSection::create(
                    'GoogleAnalyticsConfig',
                    $this->owner->fieldLabel('GoogleAnalyticsConfig'),
                    [
                        CheckboxField::create(
                            'GoogleAnalyticsEnabled',
                            $this->owner->fieldLabel('GoogleAnalyticsEnabled')
                        ),
                        TextField::create(
                            'GoogleAnalyticsTrackingID',
                            $this->owner->fieldLabel('GoogleAnalyticsTrackingID')
                        )->setAttribute('spellcheck', 'false')
                    ]
                ),
                FieldSection::create(
                    'GoogleVerificationConfig',
                    $this->owner->fieldLabel('GoogleVerificationConfig'),
                    [
                        TextField::create(
                            'GoogleVerificationCode',
                            $this->owner->fieldLabel('GoogleVerificationCode')
                        )->setAttribute('spellcheck', 'false')
                    ]
                )
            ]
        );
    }
1061333
public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->addFieldsToTab(
            "Root.Main",
            array(
                SortableUploadField::create(
                    'Images',
                    'Current Image(s)'
                )
            )
        );

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

        return $fields;
    }
667253
public function getCMSFields()
    {
        $this->beforeUpdateCMSFields(function ($fields) {
            /** @var FieldList $fields */
            $fields->removeByName([
                'Sort',
                'AccordionID',
            ]);

            $fields->dataFieldByName('Image')
                ->setFolderName('Uploads/Elements/Accordions');
        });

        return parent::getCMSFields();
    }
974862
public function updateFormFields(FieldList $fields)
    {
        $sites = Subsite::accessible_sites('CMS_ACCESS_AssetAdmin');
        $values = [];
        $values[0] = _t(__CLASS__ . '.AllSitesDropdownOpt', 'All sites');
        foreach ($sites as $site) {
            $values[$site->ID] = $site->Title;
        }
        ksort($values);
        if ($sites) {
            // Dropdown needed to move folders between subsites
            /** @var @skipUpgrade */
            $dropdown = DropdownField::create(
                'SubsiteID',
                _t(__CLASS__ . '.SubsiteFieldLabel', 'Subsite'),
                $values
            );
            $dropdown->addExtraClass('subsites-move-dropdown');
            $fields->push($dropdown);
            $fields->push(LiteralField::create(
                'Message',
                '<p class="alert alert-info">' .
                _t(
                    __CLASS__ . '.SUBSITENOTICE',
                    'Folders and files created in the main site are accessible by all subsites.'
                )
                . '</p>'
            ));
        }
    }
309624
public function getCMSFields()
    {
        $fields = FieldList::create(
            TabSet::create(
                'Root',
                Tab::create('Main')
            )
            ->setTitle(_t(__CLASS__ . '.TABMAIN', 'Main'))
        );

        $fields->addFieldToTab(
            'Root.Main',
            GridField::create(
                'Links',
                _t(__CLASS__ . '.FIELDLINKS', 'Links'),
                $this->Links,
                GridFieldConfig_RecordEditor::create()
                    ->addComponent(new GridFieldOrderableRows('Sort'))
            )
        );

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

        return $fields;
    }
443116
public function updateCMSFields(FieldList $fields)
    {
        // Create Style Fields:
        
        $fields->addFieldToTab(
            'Root.Style',
            FieldSection::create(
                'ImageResizeStyle',
                $this->owner->fieldLabel('ImageResizeStyle'),
                [
                    DimensionsField::create(
                        'ImageResize',
                        $this->owner->fieldLabel('ImageResize')
                    ),
                    DropdownField::create(
                        'ImageResizeMethod',
                        $this->owner->fieldLabel('ImageResizeMethod'),
                        $this->tools()->getResizeMethods()
                    )->setEmptyString(' ')->setAttribute('data-placeholder', _t(__CLASS__ . '.NONE', 'None'))
                ]
            )
        );
    }
1265847
public function updateFrontEndFields(FieldList $fields)
    {
        if (!$this->owner->ID) {
            $fields->replaceField('InheritPerms', new CheckboxField('InheritPerms', _t('Restrictable.INHERIT_PERMS', 'Inherit Permissions'), true));
        }
        
        $ownerField = $fields->fieldByName('OwnerID');
        if ($ownerField) {
            $members = singleton('DataService')->getAllMember();
            $source = array();
            if ($members) {
                $source = $members->map();
            }
            if (method_exists($ownerField, 'setSource')) {
                $ownerField->setSource($source);
            }
        }
    }
1359725
public function update() {
		$t = new Template;
		$t->name = $this->getTemplateName();

		$fg = new Fieldgroup;
		$fg->name =  $this->getTemplateName();
		foreach($this->fields as $field) { // add global fields
			if(!($field->flags & Field::flagGlobal)) continue;
			$fg->add($field);
		}
		$fg->save();
		$t->fieldgroup = $fg;

		$t->fieldgroup->save();
		$t->save();

		$this->templateSetup($t);

		$t->fieldgroup->save();
		$t->save();

		return $t;
	}
884890
public function getCMSFields()
    {
        // Create Field Tab Set:
        
        $fields = FieldList::create(TabSet::create('Root'));
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                TextField::create(
                    'Title',
                    $this->fieldLabel('Title')
                )
            ]
        );
        
        // Extend Field Objects:
        
        $this->extend('updateCMSFields', $fields);
        
        // Answer Field Objects:
        
        return $fields;
    }
126942
public function updateCMSFields(FieldList $fields)
    {
        $owner = $this->owner;

        $fields->removeByName(
            array(
                'SiteTreeID',
                'Anchor'
            )
        );

        // Insert site tree field after the file selection field
        $fields->insertAfter(
            'Type',
            DisplayLogicWrapper::create(
                TreeDropdownField::create(
                    'SiteTreeID',
                    _t('Links.PAGE', 'Page'),
                    'SiteTree'
                ),
                TextField::create(
                    'Anchor',
                    _t('Links.ANCHOR', 'Anchor/Querystring')
                )->setRightTitle(_t('Links.ANCHORINFO', 'Include # at the start of your anchor name or, ? at the start of your querystring'))
            )->displayIf("Type")->isEqualTo("SiteTree")->end()
        );

        // Display warning if the selected page is deleted or unpublished
        if ($owner->SiteTreeID && !$owner->SiteTree()->isPublished()) {
            $fields
                ->dataFieldByName('SiteTreeID')
                ->setRightTitle(_t('Links.DELETEDWARNING', 'Warning: The selected page appears to have been deleted or unpublished. This link may not appear or may be broken in the frontend'));
        }
    }
759308
public function getCMSFields()
    {
        $fields = parent::getCMSFields();
        $fields->addFieldsToTab(
            "Root.Main",
            array(
                DropdownField::create(
                    'ShowHome',
                    'Show home',
                    array(
                        "1" => "Yes",
                        "0" => "No"
                    ),
                    1
                )
            )
        );

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

        return $fields;
    }
136657
public function setFieldList($field_list = array())
    {
        if (empty($field_list)) $this->_field_list = array('*');
        $this->_field_list = (array)$field_list;

        return $this;
    }
544788
private static function _autoUpdateFromFields(&$fields)
    {
        $addKeywords = [null, null];
        $removeKeywords = [null, null];

        if (isset($fields->add) && isset($fields->add->first_word)) {
            $addKeywords[0] = $fields->add->first_word;
        }

        if (isset($fields->add) && isset($fields->add->second_word)) {
            $addKeywords[1] = $fields->add->second_word;
        }

        if (isset($fields->remove) && isset($fields->remove->first_word)) {
            $removeKeywords[0] = $fields->remove->first_word;
        }

        if (isset($fields->remove) && isset($fields->remove->second_word)) {
            $removeKeywords[1] = $fields->remove->second_word;
        }

        return new Api\GroupAutoUpdate(
            $fields->to, $addKeywords, $removeKeywords
        );
    }
932622
public function updateCMSFields(FieldList $fields)
    {
        $gridField = GridField::create(
            'CarouselItems',
            _t(__CLASS__ . 'TITLE', 'Hero/Carousel'),
            $this->getCarouselItems(),
            GridFieldConfig_RelationEditor::create()
        );
        $gridField->setDescription(_t(
            __CLASS__ . 'NOTE',
            'NOTE: Carousel functionality will automatically be loaded when 2 or more items are added below'
        ));
        $gridConfig = $gridField->getConfig();
        $gridConfig->getComponentByType(GridFieldAddNewButton::class)->setButtonName(
            _t(__CLASS__ . 'ADDNEW', 'Add new')
        );
        $gridConfig->removeComponentsByType(GridFieldAddExistingAutocompleter::class);
        $gridConfig->removeComponentsByType(GridFieldDeleteAction::class);
        $gridConfig->addComponent(new GridFieldDeleteAction());
        $gridConfig->addComponent(new GridFieldOrderableRows('SortOrder'));
        $gridConfig->removeComponentsByType(GridFieldSortableHeader::class);
        $gridField->setModelClass(CarouselItem::class);

        $fields->findOrMakeTab(
            'Root.Carousel',
            _t(__CLASS__ . 'TITLE', 'Hero/Carousel')
        );

        $fields->addFieldToTab('Root.Carousel', $gridField);
    }