Update Fields
@return FieldList
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;
    }
911007
public function updateCMSFields(FieldList $fields) {

		$permissions = array(
			'ADMIN' => 'Administrators and developers',
			'SITETREE_EDIT_ALL' => 'Content authors'
		);

		// Confirm that the current CMS user has permission.

		if(Permission::check('EDIT_SITECONFIG') === false) {
			$fields->addFieldToTab('Root.Access', $options = ReadonlyField::create(
				'Media',
				'Who can customise media?',
				$permissions[$this->owner->MediaPermission]
			));
		}
		else {

			// Display the permission configuration.

			$fields->addFieldToTab('Root.Access', $options = OptionsetField::create(
				'MediaPermission',
				'Who can customise media?',
				$permissions
			));
		}

		// Allow extension customisation.

		$this->owner->extend('updateSiteConfigMediaPermissionExtensionCMSFields', $fields);
	}
343010
public function updateCMSFields(FieldList $fields)
    {
        if (!Permission::check("VIEW_SECTIONS")) {
            return $fields;
        }

        $SectionGrid = GridFieldConfig_RelationEditor::create()
            ->removeComponentsByType('GridFieldAddNewButton')
            ->addComponent(new GridFieldAddNewMultiClass())
            ->addComponent(new GridFieldOrderableRows());

        $SectionGrid->getComponentByType('GridFieldAddExistingAutocompleter')
            ->setSearchFields(array('AdminTitle', 'MenuTitle'))
            ->setResultsFormat('$AdminTitle - $Type');

        $AvailableTypes = $this->AvailableSectionTypes();

        foreach ($AvailableTypes as $key => $value) {
            if($value['selectable_option'] && !$value['limit_reached']){
                $AvailableTypes[$key] = $value['type'];
            }
        }

        $SectionGrid->getComponentByType('GridFieldAddNewMultiClass')
            ->setClasses($AvailableTypes);

        // Limit total sections
        $LimitSectionTotal = Config::inst()->get($this->owner->ClassName, 'LimitSectionTotal');
        if (isset($LimitSectionTotal) && $this->owner->Sections()->Count() >= $LimitSectionTotal) {
            // remove the buttons if we don't want to allow more records to be added/created
            $SectionGrid->removeComponentsByType('GridFieldAddNewButton');
            $SectionGrid->removeComponentsByType('GridFieldAddExistingAutocompleter');
            $SectionGrid->removeComponentsByType('GridFieldAddNewMultiClass');
        }

        if (!Permission::check("LINK_SECTIONS")) {
            $SectionGrid->removeComponentsByType('GridFieldAddExistingAutocompleter');
        }

        if (!Permission::check("REORDER_SECTIONS")) {
            $SectionGrid->removeComponentsByType('GridFieldOrderableRows');
        }

        if (!Permission::check("UNLINK_SECTIONS")) {
            $SectionGrid->removeComponentsByType('GridFieldDeleteAction');
        }

        $fields->addFieldToTab(
            'Root.Section',
            GridField::create(
                'Sections',
                'Current Section(s)',
                $this->owner->Sections(),
                $SectionGrid
            )
        );

        $fields->addFieldToTab(
            'Root.Preview',
            UploadField::create(
                'PreviewImage',
                'Preview image'
            )->setFolderName('Preview')
        );

        return $fields;
    }
1221746
public function updateCMSFields(FieldList $fields)
    {
        $owner = $this->owner;
        $tab = $owner->config()->get('embed_tab');
        $tab = isset($tab) ? $tab : 'Main';

        // Ensure these fields don't get added by fields scaffold
        $fields->removeByName([
            'EmbedTitle',
            'EmbedType',
            'EmbedSourceURL',
            'EmbedSourceImageURL',
            'EmbedHTML',
            'EmbedWidth',
            'EmbedHeight',
            'EmbedAspectRatio',
            'EmbedDescription',
            'EmbedImage'
        ]);

        $fields->addFieldsToTab(
            'Root.' . $tab,
            array(
                TextField::create(
                    'EmbedTitle',
                    _t(__CLASS__ . '.TITLELABEL', 'Title')
                )
                ->setDescription(
                    _t(__CLASS__ . '.TITLEDESCRIPTION', 'Optional. Will be auto-generated if left blank')
                ),
                TextField::create(
                    'EmbedSourceURL',
                    _t(__CLASS__ . '.SOURCEURLLABEL', 'Source URL')
                )
                ->setDescription(
                    _t(__CLASS__ . '.SOURCEURLDESCRIPTION', 'Specify a external URL')
                ),
                UploadField::create(
                    'EmbedImage',
                    _t(__CLASS__ . '.IMAGELABEL', 'Image')
                )
                ->setFolderName($owner->EmbedFolder)
                ->setAllowedExtensions(['jpg','png','gif']),
                TextareaField::create(
                    'EmbedDescription',
                    _t(__CLASS__ . '.DESCRIPTIONLABEL', 'Description')
                )
            )
        );

        if (isset($owner->AllowedEmbedTypes) && Count($owner->AllowedEmbedTypes) > 1) {
            $fields->addFieldToTab(
                'Root.' . $tab,
                ReadonlyField::create(
                    'EmbedType',
                    _t(__CLASS__ . '.TYPELABEL', 'Type')
                ),
                'EmbedImage'
            );
        }

        return $fields;
    }
1295672
public function updateCMSFields(FieldList $fields)
    {
        $owner = $this->owner;
        $fields->addFieldToTab(
            'Root.Main',
            TextField::create(
                'IDCustomValue',
                _t(__CLASS__ . '.ID', 'ID')
            )
            ->setDescription(_t(__CLASS__ . '.IDCUSTOMVALUE', 'Define an ID for the link.  This is particularly useful for google tracking.'))
        );
        return $fields;
    }
410507
public function updateCMSFields(FieldList $fields)
    {
        // only apply the update to files (not folders)
        if ($this->owner->class != 'Folder') {
            // add the tabs from the translatable tab set to the fields
            /** @var TabSet $set */
            $set = $this->owner->getTranslatableTabSet();

            // Remove the tab of the default locale (these are in the "main" tab)
            $set->removeByName(Translatable::default_locale());

            foreach ($set->FieldList() as $tab) {
                $fields->addFieldToTab('Root', $tab);
            }
        }
    }
1099388
protected function get_fieldlist() : array {
        global $DB;

        if (null === $this->fields) {
            $fields = [];
            foreach (array_keys($DB->get_columns($this->tablename)) as $fieldname) {
                $fields["{$this->fieldprefix}{$fieldname}"] = $fieldname;
            }

            $this->fields = $fields;
        }

        return $this->fields;
    }
101745
public function updateCMSFields(FieldList $fields)
    {
        // Define Placeholder:
        
        $placeholder = _t(__CLASS__ . '.DROPDOWNSELECT', 'Select');
        
        // Create Main Fields:
        
        $fields->addFieldsToTab(
            'Root.Main',
            [
                DropdownField::create(
                    'ListSourceID',
                    $this->owner->fieldLabel('ListSourceID'),
                    $this->getListSourceOptions()
                )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder)
            ]
        );
        
        // Create Options Fields:
        
        $fields->addFieldToTab(
            'Root.Options',
            FieldSection::create(
                'ListSourceOptions',
                $this->owner->fieldLabel('ListSourceOptions'),
                [
                    TextField::create(
                        'NumberOfItems',
                        $this->owner->fieldLabel('NumberOfItems')
                    ),
                    DropdownField::create(
                        'SortItemsBy',
                        $this->owner->fieldLabel('SortItemsBy'),
                        $this->owner->getSortItemsByOptions()
                    ),
                    CheckboxField::create(
                        'ReverseItems',
                        $this->owner->fieldLabel('ReverseItems')
                    ),
                    CheckboxField::create(
                        'ImageItems',
                        $this->owner->fieldLabel('ImageItems')
                    )
                ]
            )
        );
        
        // Create Pagination Options (if permitted):
        
        if ($this->owner->canPaginate()) {
            
            $fields->insertBefore(
                SelectionGroup::create(
                    'PaginateItems',
                    [
                        SelectionGroup_Item::create(
                            '0',
                            null,
                            $this->owner->fieldLabel('Disabled')
                        ),
                        SelectionGroup_Item::create(
                            '1',
                            TextField::create(
                                'ItemsPerPage',
                                $this->owner->fieldLabel('ItemsPerPage')
                            ),
                            $this->owner->fieldLabel('Enabled')
                        )
                    ]
                )->setTitle($this->owner->fieldLabel('PaginateItems')),
                'ReverseItems'
            );
            
        }
    }
55779
public function getFormFields()
    {
        $fields = new UserFormsFieldList();
        $target = $fields;

        foreach ($this->controller->data()->Fields() as $field) {
            $target = $target->processNext($field);
        }
        $fields->clearEmptySteps();
        $this->extend('updateFormFields', $fields);
        $fields->setForm($this);
        return $fields;
    }
992070
public function update($fieldValues)
    {
        $r = 0;
        foreach ($this->queries as $query) {
            $t = $query->update($fieldValues);
            $r += $t;
        }

        return $r;
    }
1138181
public function updateCMSFields(FieldList $fields)
    {
        // Update Field Objects (from parent):
        
        parent::updateCMSFields($fields);
        
        // Define Placeholder:
        
        $placeholder = _t(__CLASS__ . '.DROPDOWNDEFAULT', '(default)');
        
        // Create Style Fields:
        
        $fields->addFieldsToTab(
            'Root.Style',
            [
                FieldSection::create(
                    'CornerStyle',
                    $this->owner->fieldLabel('Corners'),
                    [
                        DropdownField::create(
                            'CornerStyle',
                            $this->owner->fieldLabel('CornerStyle'),
                            $this->owner->getCornerStyleOptions()
                        )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder)
                    ]
                )
            ]
        );
    }
408719
public function updateCMSFields(FieldList $fields)
    {
        // Update Field Objects (from parent):
        
        parent::updateCMSFields($fields);
        
        // Create Style Fields:
        
        $fields->addFieldsToTab(
            'Root.Style',
            [
                FieldSection::create(
                    'LinkColorStyle',
                    $this->owner->fieldLabel('LinkColorStyle'),
                    [
                        FieldGroup::create(
                            $this->owner->fieldLabel('Background'),
                            [
                                ColorField::create(
                                    'ColorBackgroundLink',
                                    $this->owner->fieldLabel('Link')
                                ),
                                ColorField::create(
                                    'ColorBackgroundHover',
                                    $this->owner->fieldLabel('Hover')
                                ),
                                ColorField::create(
                                    'ColorBackgroundActive',
                                    $this->owner->fieldLabel('Active')
                                )
                            ]
                        ),
                        FieldGroup::create(
                            $this->owner->fieldLabel('Foreground'),
                            [
                                ColorField::create(
                                    'ColorForegroundLink',
                                    $this->owner->fieldLabel('Link')
                                ),
                                ColorField::create(
                                    'ColorForegroundHover',
                                    $this->owner->fieldLabel('Hover')
                                ),
                                ColorField::create(
                                    'ColorForegroundActive',
                                    $this->owner->fieldLabel('Active')
                                )
                            ]
                        )
                    ]
                )
            ]
        );
    }
800279
public function getUpdate()
    {
        $update = [];

        foreach ($this->update as $field => $data) {
            list($type, $value) = $data;

            if (! isset($update[$type])) {
                $update[$type] = [];
            }

            $update[$type][$field] = $value;
        }

        if ($this->atomic) {
            $update['$atomic'] = 1;
        }

        return $update;
    }
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);
    }
1161096
public function update($fieldValues)
    {
        foreach ($fieldValues as $field => $value) {
            if ($value instanceof ExpressionInterface) {
                if ($value instanceof Increment) {
                    $fieldValues[] = "[$field]=[$field]" . ($value->step >= 0 ? '+' : '') . $value->step;
                } elseif ($value instanceof Raw) {
                    $fieldValues[] = "[$field]=" . $value->expression;
                }
                unset($fieldValues[$field]);
            }
        }

        return $this->getConnection()->update($this->getSource(), $fieldValues, $this->_conditions, $this->_bind);
    }
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)
1097631
public function updateCMSFields(FieldList $fields)
    {
        // Update Field Objects (from parent):
        
        parent::updateCMSFields($fields);
        
        // Create Icons Tab:
        
        $fields->findOrMakeTab('Root.SilverWare.Icons', $this->owner->fieldLabel('Icons'));
        
        // Create Icon Upload Fields:
        
        $fields->addFieldsToTab(
            'Root.SilverWare.Icons',
            [
                $small = UploadField::create(
                    'AppIconSmall',
                    $this->owner->fieldLabel('AppIconSmall')
                )->setAllowedFileCategories('image')->setFolderName($this->getAssetFolder()),
                $large = UploadField::create(
                    'AppIconLarge',
                    $this->owner->fieldLabel('AppIconLarge')
                )->setAllowedFileCategories('image')->setFolderName($this->getAssetFolder()),
                $touch = UploadField::create(
                    'AppIconTouch',
                    $this->owner->fieldLabel('AppIconTouch')
                )->setAllowedFileCategories('image')->setFolderName($this->getAssetFolder())
            ]
        );
        
        // Define Icon Upload Fields:
        
        $small->setRightTitle(
            _t(
                __CLASS__ . '.APPICONSMALLRIGHTTITLE',
                'Used for the bookmark icon (16 x 16 pixels recommended).'
            )
        );
        
        $large->setRightTitle(
            _t(
                __CLASS__ . '.APPICONLARGERIGHTTITLE',
                'Used for social media sharing (at least 500 x 500 pixels recommended).'
            )
        );
        
        $touch->getValidator()->setAllowedExtensions(['png']);
        $touch->setRightTitle(
            _t(
                __CLASS__ . '.APPICONTOUCHRIGHTTITLE',
                'Used for touch icons (at least 500 x 500 pixels recommended, PNG format required).'
            )
        );
    }