Update the SiteConfig with the news-settings.
The tabs are pushed into arrays, because it works better than adding them one by one.

@param FieldList $fields of current FieldList of SiteConfig
546677
public function updateCMSFields(FieldList $fields)
    {
        /** Only allow authors or higher! */
        $fields->addFieldToTab(
            'Root', // What tab
            TabSet::create(
                'Newssettings', _t('NewsSiteConfigExtension.NEWSCOMMENTS', 'News settings')
            )
        );
        if (($this->owner->AllowAuthors && $this->owner->canEdit(Member::currentUser())) || Member::currentUser()->inGroup('administrators')) {
            $userTabs = array();
            foreach (self::$config_tabs as $tab) {
                $userTabs[] = $this->$tab();
            }
            $fields->addFieldsToTab('Root.Newssettings', $userTabs);
        } else {
            $fields->addFieldToTab('Root.Newssettings', HeaderField::create('NoPermissions', _t('NewsSiteConfigExtension.PERMISSIONERROR', 'You do not have the permission to edit these settings')));
        }
        if (Member::currentUser()->inGroup('administrators')) {
            $adminTabs = array();
            foreach (self::$admin_tabs as $tab) {
                $adminTabs[] = $this->$tab();
            }
            $fields->addFieldsToTab('Root.Newssettings', $adminTabs, 'Help');
        }
    }
387955
public function updateCMSFields(FieldList $fields)
    {
        $tabName = $this->owner->config()->get('meta_tab_name');
        // copy meta fields from main
        if ($Metadata = $fields->fieldByName('Root.Main.Metadata')) {
            $fields->removeFieldFromTab('Root.Main', 'Metadata');
            $fields->addFieldToTab(
                "Root.$tabName",
                TextField::create(
                    "MetaTitle",
                    _t('SiteTree.METATITLE', 'Meta Title')
                )
            );
            $fields->addFieldsToTab(
                "Root.$tabName",
                $Metadata->getChildren()
            );
            // Remove extra meta because we don't really need it
            $fields->removeByName('ExtraMeta');
            $fields->fieldByName("Root.$tabName.MetaDescription")
                ->setRows(2);
        }
        $fields->addFieldsToTab(
            "Root.$tabName",
            array(
                UploadField::create(
                    'MetaImageCustom',
                    _t('SiteTree.METAIMAGECUSTOM', 'Meta Image')
                )
                    ->setAllowedFileCategories('image')
                    ->setAllowedMaxFileNumber(1),
                HeaderField::create(
                    'RobotsHeader',
                    _t('SiteTree.ROBOTSHEADER', 'Search engine')
                ),
                CheckboxField::create(
                    'NoIndex',
                    _t('SiteTree.NOINDEX', 'Prevent indexing of this page')
                ),
                CheckboxField::create(
                    'NoFollow',
                    _t('SiteTree.NOFOLLOW', 'Prevent following links on this page')
                ),
                CheckboxField::create(
                    'NoSnippet',
                    _t('SiteTree.NOSNIPPET', 'Prevent showing a snippet of this page in the search results')
                ),
                CheckboxField::create(
                    'NoCache',
                    _t('SiteTree.NOCACHE', 'Prevent caching a version of this page')
                ),
                HeaderField::create(
                    'SocialHeader',
                    _t('SiteTree.SOCIALHEADER', 'Social')
                ),
                TextField::create(
                    'OGTitleCustom',
                    _t('SiteTree.SHARETITLE', 'Share title')
                )
                    ->setMaxLength(90),
                TextAreaField::create(
                    'OGDescriptionCustom',
                    _t('SiteTree.SHAREDESCRIPTION', 'Share description')
                )
                    ->setRows(2),
                UploadField::create(
                    'OGImageCustom',
                    _t('SiteTree.SHAREIMAGE', 'Share image')
                )
                    ->setAllowedFileCategories('image')
                    ->setAllowedMaxFileNumber(1)
                    ->setDescription('<a href="https://developers.facebook.com/docs/sharing/best-practices#images" target="_blank">Optimum image ratio</a> is 1.91:1. (1200px wide by 630px tall or better)'),
                // Facebook
                TextField::create(
                    "FBAuthorlink",
                    _t('SiteTree.FBAUTHORLINK', 'Facebook author')
                )
                    ->setRightTitle(_t('SiteTree.FBAUTHORLINKHELP', 'Author Facebook PROFILE URL')),
                TextField::create(
                    "FBPublisherlink",
                    _t('SiteTree.FBPUBLISHERLINK', 'Facebook publisher')
                )
                    ->setRightTitle(_t('SiteTree.FBPUBLISHERLINKHELP', 'Publisher Facebook PAGE URL')),
                // Google plus
                TextField::create(
                    "GplusAuthorlink",
                    _t('SiteTree.GPLUSAUTHORLINK', 'Google+ author')
                )
                    ->setRightTitle(_t('SiteTree.GPLUSAUTHORLINKHELP', 'Author Google+ PROFILE URL')),
                TextField::create(
                    "GplusPublisherlink",
                    _t('SiteTree.GPLUSPUBLISHERLINK', 'Google+ publisher')
                )
                    ->setRightTitle(_t('SiteTree.GPLUSPUBLISHERLINKHELP', 'Publisher Google+ PAGE URL')),
                HeaderField::create(
                    'RichSnippetsHeader',
                    _t('SiteTree.RICHSNIPPETSHEADER', 'Rich snippets')
                ),
                UploadField::create(
                    'BreadcrumbIcon',
                    _t('SiteTree.BREADCRUMBICON', 'Breadcrumb Icon')
                )
                    ->setAllowedFileCategories('image')
                    ->setAllowedMaxFileNumber(1)
            )
        );

        if (Config::inst()->get('ShareCare', 'pinterest')) {
            $fields->addFieldToTab(
                "Root.$tabName",
                UploadField::create(
                    'PinterestImageCustom',
                    _t('SiteTree.PINTERESTIMAGE', "Pinterest image")
                )
                    ->setAllowedFileCategories('image')
                    ->setAllowedMaxFileNumber(1)
                    ->setDescription('Square/portrait or taller images look best on Pinterest. This image should be at least 750px wide.'));
        }

        return $fields;
    }
1056399
public function updateCMSFields(FieldList $fields)
    {
        $owner = $this->owner;
        $fields->addFieldToTab(
            "Root.Main",
            HiddenField::create(
                'SubsiteID',
                'SubsiteID',
                Subsite::currentSubsiteID()
            )
        );
        return $fields;
    }
306776
protected function updateSetting($field, $value)
    {
        $value = is_array($value) ? json_encode($value) : $value;

        return $this->getTableObject()
            ->where('id', $field)
            ->update(['value' => $value]);
    }
1269895
protected function saveOriginalFieldNames(array $fields, string $field): void
	{
		foreach($fields as $expanded)
		{
			$this->originalFieldNames[$expanded] = $field;
		}
	}
325495
public function updateCMSFields(FieldList $fields)
	{
		if ($fields->fieldByName('Root.Blocks') || !$this->showBlocksFields()) {
			return;
		}

		$areas = $this->blockManager->getAreasForPageType($this->owner->ClassName);

		if ($areas && count($areas)) {
			$fields->addFieldToTab('Root', new Tab('Blocks', _t('Block.PLURALNAME', 'Blocks')));
			if (BlockManager::config()->get('block_area_preview')) {
				$fields->addFieldToTab('Root.Blocks',
						LiteralField::create('PreviewLink', $this->areasPreviewButton()));
			}

			// Blocks related directly to this Page
			$gridConfig = GridFieldConfigBlockManager::create(true, true, true, true)
				->addExisting($this->owner->class)
				//->addBulkEditing()
				// ->addComponent(new GridFieldOrderableRows()) // Comment until below TODO is complete.
				;


			// TODO it seems this sort is not being applied...
			$gridSource = $this->owner->Blocks();
				// ->sort(array(
				// 	"FIELD(SiteTree_Blocks.BlockArea, '" . implode("','", array_keys($areas)) . "')" => '',
				// 	'SiteTree_Blocks.Sort' => 'ASC',
				// 	'Name' => 'ASC'
				// ));

			$fields->addFieldToTab('Root.Blocks', GridField::create('Blocks', _t('Block.PLURALNAME', 'Blocks'), $gridSource, $gridConfig));


			// Blocks inherited from BlockSets
			if ($this->blockManager->getUseBlockSets()) {
				$inheritedBlocks = $this->getBlocksFromAppliedBlockSets(null, true);

				if ($inheritedBlocks->count()) {
					$activeInherited = $this->getBlocksFromAppliedBlockSets(null, false);

					if ($activeInherited->count()) {
						$fields->addFieldsToTab('Root.Blocks', [
							GridField::create('InheritedBlockList', _t('BlocksSiteTreeExtension.BlocksInheritedFromBlockSets', 'Blocks Inherited from Block Sets'), $activeInherited,
								GridFieldConfigBlockManager::create(false, false, false)),
							LiteralField::create('InheritedBlockListTip', "<p class='message'>"._t('BlocksSiteTreeExtension.InheritedBlocksEditLink', 'Tip: Inherited blocks can be edited in the {link_start}Block Admin area{link_end}', '', ['link_start' => '<a href="admin/block-admin">', 'link_end' => '</a>']).'<p>'),
						]);
					}

					$fields->addFieldToTab('Root.Blocks',
							ListboxField::create('DisabledBlocks', _t('BlocksSiteTreeExtension.DisableInheritedBlocks', 'Disable Inherited Blocks'),
									$inheritedBlocks->map('ID', 'Title'), null, null, true)
									->setDescription(_t('BlocksSiteTreeExtension.DisableInheritedBlocksDescription', 'Select any inherited blocks that you would not like displayed on this page.'))
					);
				} else {
					$fields->addFieldToTab('Root.Blocks',
							ReadonlyField::create('DisabledBlocksReadOnly', _t('BlocksSiteTreeExtension.DisableInheritedBlocks', 'Disable Inherited Blocks'),
									_t('BlocksSiteTreeExtension.NoInheritedBlocksToDisable','This page has no inherited blocks to disable.')));
				}

				$fields->addFieldToTab('Root.Blocks',
					CheckboxField::create('InheritBlockSets', _t('BlocksSiteTreeExtension.InheritBlocksFromBlockSets', 'Inherit Blocks from Block Sets')));
			}
		}
	}
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;
    }
215485
public function update( $field, $value ) {
		if ( isset($this->ID) ) {
			update_post_meta($this->ID, $field, $value);
			$this->$field = $value;
		}
	}
1109221
public function updateSettingsFields(FieldList $fields)
    {
        $options = FieldGroup::create()->setTitle(_t(__CLASS__ . '.COMMENTOPTIONS', 'Comments'));

        // Check if enabled setting should be cms configurable
        if ($this->owner->getCommentsOption('enabled_cms')) {
            $options->push(CheckboxField::create('ProvideComments', _t(
                'SilverStripe\\Comments\\Model\\Comment.ALLOWCOMMENTS',
                'Allow Comments'
            )));
        }

        // Check if we should require users to login to comment
        if ($this->owner->getCommentsOption('require_login_cms')) {
            $options->push(
                CheckboxField::create(
                    'CommentsRequireLogin',
                    _t('Comments.COMMENTSREQUIRELOGIN', 'Require login to comment')
                )
            );
        }

        if ($options->FieldList()->count()) {
            if ($fields->hasTabSet()) {
                $fields->addFieldsToTab('Root.Settings', $options);
            } else {
                $fields->push($options);
            }
        }

        // Check if moderation should be enabled via cms configurable
        if ($this->owner->getCommentsOption('require_moderation_cms')) {
            $moderationField = DropdownField::create(
                'ModerationRequired',
                _t(
                    __CLASS__ . '.COMMENTMODERATION',
                    'Comment Moderation'
                ),
                [
                    'None' => _t(__CLASS__ . '.MODERATIONREQUIRED_NONE', 'No moderation required'),
                    'Required' => _t(__CLASS__ . '.MODERATIONREQUIRED_REQUIRED', 'Moderate all comments'),
                    'NonMembersOnly' => _t(
                        __CLASS__ . '.MODERATIONREQUIRED_NONMEMBERSONLY',
                        'Only moderate non-members'
                    ),
                ]
            );
            if ($fields->hasTabSet()) {
                $fields->addFieldToTab('Root.Settings', $moderationField);
            } else {
                $fields->push($moderationField);
            }
        }
    }
141574
public function updateCMSFields(FieldList $fields)
    {
        // Update Field Objects (from parent):
        
        parent::updateCMSFields($fields);
        
        // Create Page Types Grid Field:
        
        $types = GridField::create(
            'AppPageTypes',
            $this->owner->fieldLabel('AppPageTypes'),
            $this->owner->AppPageTypes(),
            GridFieldConfig_RecordEditor::create()
        );
        
        // Create Page Types Tab:
        
        $fields->findOrMakeTab('Root.SilverWare.PageTypes', $this->owner->fieldLabel('AppPageTypes'));
        
        // Add Grid Field to Page Types Tab:
        
        $fields->addFieldToTab('Root.SilverWare.PageTypes', $types);
    }
395903
public function updateCMSFields(FieldList $fields)
    {
        $fieldEditor = $this->getFieldEditorGrid();

        $fields->insertAfter(new Tab('FormFields', _t(__CLASS__.'.FORMFIELDS', 'Form Fields')), 'Main');
        $fields->addFieldToTab('Root.FormFields', $fieldEditor);

        return $fields;
    }
1269137
public function updateWorkflowFields($fields)
    {
        $fieldDiff = $this->Workflow()->getTargetDiff();

        foreach ($fieldDiff as $field) {
            $display = ReadonlyField::create(
                'workflow-' . $field->Name,
                $field->Title,
                DBField::create_field('HTMLText', $field->Diff)
            )
                ->addExtraClass('workflow-field-diff');
            $fields->push($display);
        }

        if ($this->BaseAction()->AllowCommenting) {
            $fields->push(new TextareaField('Comment', _t('WorkflowAction.COMMENT', 'Comment')));
        }
    }
615788
public function updatePageOptions(FieldList $fields)
    {
        $pageTypeField = $fields->fieldByName('PageType');
        foreach ($pageTypeField->getSource() as $classKey => $classValue) {
            if ($classKey == 'PlaceablePage') {
                foreach (PlaceablePageType::get() as $type) {
                    $html = sprintf('%s<strong class="title">%s</strong><span class="description">%s</span>',
                        ($type->Icon()->exists()) ? '<img class="page-icon" src="'.$type->Icon()->croppedImage(16,16)->URL.'" />': '<span class="page-icon"></span>',
                        $type->Title,
                        $type->Description
                    );
                    $PageTypes["$classKey-$type->ID"] = DBField::create_field('HTMLText', $html);
                }
            } else {
                $PageTypes["$classKey-0"] = $classValue;
            }
        }

        $numericLabelTmpl = '<span class="step-label"><span class="flyout">%d</span><span class="arrow"></span><span class="title">%s</span></span>';

        $fields->removeByName(
            array(
                'PageType',
                'RestrictedNote'
            )
        );
        $fields->addFields(
            array(
                OptionsetField::create(
                    'PageTypeFake',
                    sprintf($numericLabelTmpl, 2, _t('CMSMain.ChoosePageType', 'Choose page type')),
                    $PageTypes
                ),
                HiddenField::create('PageType','PageType'),
                HiddenField::create('PageTypeID','PageTypeID')
            )
        );
        return $fields;
    }
963194
void setFields(Field[] fields) {
    this.fields = fields;
    this.resultSetColumnNameIndexMap = null;
    this.cachedMaxResultRowSize = null;
    this.needUpdateFieldFormats = fields != null;
    this.hasBinaryFields = false; // just in case
  }
854015
public function updateCMSFields(FieldList $fields)
    {
        // Create Style Tab:
        
        $fields->findOrMakeTab('Root.Style', $this->owner->fieldLabel('Style'));
        
        // Define Placeholder:
        
        $placeholder = _t(__CLASS__ . '.DROPDOWNDEFAULT', '(default)');
        
        // Create Style Fields:
        
        $fields->addFieldToTab(
            'Root.Style',
            FieldSection::create(
                'ImageDefaultsStyle',
                $this->owner->fieldLabel('ImageDefaults'),
                [
                    DropdownField::create(
                        'ImageDefaultAlignment',
                        $this->owner->fieldLabel('ImageDefaultAlignment'),
                        ImageTools::singleton()->getAlignmentOptions()
                    )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder),
                    DimensionsField::create(
                        'ImageDefaultResize',
                        $this->owner->fieldLabel('ImageDefaultResize')
                    ),
                    DropdownField::create(
                        'ImageDefaultResizeMethod',
                        $this->owner->fieldLabel('ImageDefaultResizeMethod'),
                        ImageTools::singleton()->getResizeMethods()
                    )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder),
                    DropdownField::create(
                        'ImageDefaultLinked',
                        $this->owner->fieldLabel('ImageDefaultLinked'),
                        $this->getToggleOptions()
                    )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder)
                ]
            )
        );
    }
157331
public function setFields($fields)
    {
        foreach ($fields as $name => $value) {
            $this->parameters->addPost($name, $value);
        }
    }
737508
protected function AddUpdateFields(&$Fields) {
      $this->DefineSchema();
      if ($this->Schema->FieldExists($this->Name, $this->DateUpdated)) {
         if (!isset($Fields[$this->DateUpdated]))
            $Fields[$this->DateUpdated] = Gdn_Format::ToDateTime();
      }

      $Session = Gdn::Session();
      if ($Session->UserID > 0 && $this->Schema->FieldExists($this->Name, $this->UpdateUserID))
         if (!isset($Fields[$this->UpdateUserID]))
            $Fields[$this->UpdateUserID] = $Session->UserID;

      if ($this->Schema->FieldExists($this->Name, 'UpdateIPAddress') && !isset($Fields['UpdateIPAddress'])) {
         $Fields['UpdateIPAddress'] = Gdn::Request()->IpAddress();
      }
   }