Updates the CMS fields of the extended object.

@param FieldList $fields List of CMS fields from the extended object.

@return void
970549
public function updateCMSFields(FieldList $fields)
    {
        // Update Field Objects:
        
        $fields->fieldByName('Root.Main')->setTitle(_t(__CLASS__ . '.TABMAIN', 'Main'));
        
        // Remove Field Objects:
        
        if ($this->owner->config()->disable_metadata_toggle) {
            $fields->removeFieldFromTab('Root', 'Metadata');
        }
        
        // Add Tab Number Badges:
        
        if ($badges = $this->owner->getNumberBadgeData()) {
            $fields->fieldByName('Root')->setAttribute('data-number-badges', json_encode($badges));
        }
    }
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')
                                )
                            ]
                        )
                    ]
                )
            ]
        );
    }
1216661
public function updateCMSFields(FieldList $fields)
    {
        $global = $fields->dataFieldByName('AvailableGlobally');

        if ($global) {
            $fields->removeByName('AvailableGlobally');
            $fields->addFieldToTab('Root.Settings', $global);
        }

        if ($virtual = $fields->dataFieldByName('VirtualClones')) {
            if ($this->owner->VirtualClones()->Count() > 0) {
                $tab = $fields->findOrMakeTab('Root.VirtualClones');
                $tab->setTitle(_t(__CLASS__ . '.LinkedTo', 'Linked To'));

                if ($ownerPage = $this->owner->getPage()) {
                    $fields->addFieldToTab(
                        'Root.VirtualClones',
                        LiteralField::create(
                            'DisplaysOnPage',
                            sprintf(
                                "<p>"
                                . _t(__CLASS__ . '.OriginalContentFrom', 'The original content element appears on')
                                . " <a href='%s'>%s</a></p>",
                                ($ownerPage->hasMethod('CMSEditLink') && $ownerPage->canEdit()) ? $ownerPage->CMSEditLink() : $ownerPage->Link(),
                                $ownerPage->MenuTitle
                            )
                        ),
                        'VirtualClones'
                    );
                }

                $virtual->setConfig(new GridFieldConfig_Base());
                $virtual
                    ->setTitle(_t(__CLASS__ . '.OtherPages', 'Other pages'))
                    ->getConfig()
                        ->removeComponentsByType(GridFieldAddExistingAutocompleter::class)
                        ->removeComponentsByType(GridFieldAddNewButton::class)
                        ->removeComponentsByType(GridFieldDeleteAction::class)
                        ->removeComponentsByType(GridFieldDetailForm::class)
                        ->addComponent(new ElementalGridFieldDeleteAction());

                $virtual->getConfig()
                    ->getComponentByType(GridFieldDataColumns::class)
                    ->setDisplayFields([
                        'getPage.Title' => _t(__CLASS__ . '.GridFieldTitle', 'Title'),
                        'ParentCMSEditLink' => _t(__CLASS__ . '.GridFieldUsedOn', 'Used on'),
                    ]);
            } else {
                $fields->removeByName('VirtualClones');
            }
        }
    }
903739
public function addFields(array $fields)
    {
        $fields = Helpers\Validate::arrToLower($fields);

        Helpers\Validate::types(array_values($fields));

        $schema = $this->schema();
        $fields = array_diff_assoc($fields, $schema);

        if (!empty($fields))
        {
            $config         = $this->config();
            $config->schema = array_merge($schema, $fields);

            $data = $this->getData();
            foreach ($data as $key => $object)
            {
                foreach ($fields as $name => $type)
                {
                    if (Helpers\Validate::isNumeric($type))
                        $data[$key]->{$name} = 0;
                    else
                        $data[$key]->{$name} = null;
                }
            }

            Helpers\Data::table($this->name)->put($data);
            Helpers\Config::table($this->name)->put($config);
        }
    }
201527
public function updateCMSFields(FieldList $fields) {
        
        $fields->addFieldToTab('Root.Main', $field=new OptionsetField('DefaultPreviewMode', _t('UserPreviewPreference.DEFAULT_MODE', '_Default Preview Mode'), array(
                                                                                                                                                            'content'=>_t('UserPreviewPreference.CONTENT_MODE', '_Content Mode: Only menu and content areas are shown'),
                                                                                                                                                            'split'=>_t('UserPreviewPreference.SPLIT_MODE', '_Split Mode: Side by Side editing and previewing'),
                                                                                                                                                            'preview'=>_t('UserPreviewPreference.PREVIEW_MODE', '_Preview Mode: Only menu and preview areas are shown')
                                                                                                                                                        ), Config::inst()->get('UserPreviewPreference', 'DefaultMode')));
        
        if(Controller::curr()->getRequest()->getSession()->get('ShowPreviewSettingChangeReload')==true) {
            $field->setMessage(_t('UserPreviewPreference.CHANGE_REFRESH', '_You have updated your preview preference, you must refresh your browser to see the updated setting'), 'warning');
            Requirements::javascript('webbuilders-group/silverstripe-cmspreviewpreference: javascript/clear-local-preference.js');
            
            if($this->isSaving==false) {
                Controller::curr()->getRequest()->getSession()->clear('ShowPreviewSettingChangeReload');
            }
        }
    }
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;
    }
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);
    }
836609
public function setActualFields($fields)
    {
        if ($this->owner->model->hasMethod('getActualFields')) {
            $this->importFields($this->owner->model, $fields);
        }
    }
791297
private function update_components( $components )
    {
        foreach ( $components as $component ) 
        {
            // Update each component in the composite collection
            if ( $component instanceof UI\Components\Composite )
            {
                $this->update_components( $component->components );
            }
            
            // Update individual fields, as well as the composite parent field.
            if ( $component instanceof UI\ValueComponentInterface )
            {
                $this->update_component( $component );
            }
        }
    }
688997
public function updateCMSFields(FieldList $fields) {

        // exclude SEO tab from some pages
        $excluded = Config::inst()->get(self::class, 'excluded_page_types');

        if ($excluded) {
            if (in_array($this->owner->getClassName(), $excluded)) {
                return;
            }
        }

        Requirements::css('hubertusanton/silverstripe-seo:css/seo.css');
        Requirements::javascript('hubertusanton/silverstripe-seo:javascript/seo.js');

        // better do this below in some init method? :
        $this->getSEOScoreCalculation();
        $this->setSEOScoreTipsUL();

        // lets create a new tab on top
        $fields->addFieldsToTab('Root.SEO', array(
            LiteralField::create('googlesearchsnippetintro', '<h3>' . _t('SEO.SEOGoogleSearchPreviewTitle', 'Preview google search') . '</h3>'),
            LiteralField::create('googlesearchsnippet', '<div id="google_search_snippet"></div>'),
            LiteralField::create('siteconfigtitle', '<div id="ss_siteconfig_title">' . $this->owner->getSiteConfig()->Title . '</div>'),

        ));

        // move Metadata field from Root.Main to SEO tab for visualising direct impact on search result

        $fields->removeFieldFromTab('Root.Main', 'Metadata');

        /*$fields->addFieldToTab("Root.SEO", new TabSet('Options',
            new Tab('Metadata', _t('SEO.SEOMetaData', 'Meta Data')),
            new Tab('HelpAndSEOScore',  _t('SEO.SEOHelpAndScore', 'Help and SEO Score'))
        ));*/


        $fields->addFieldsToTab('Root.SEO', array(
                            TextareaField::create("MetaDescription", $this->owner->fieldLabel('MetaDescription'))
                                ->setRightTitle(
                                    _t(
                                        'SiteTree.METADESCHELP',
                                        "Search engines use this content for displaying search results (although it will not influence their ranking)."
                                    )
                                )
                                ->addExtraClass('help'),
                            TextareaField::create("ExtraMeta",$this->owner->fieldLabel('ExtraMeta'))
                                ->setRightTitle(
                                    _t(
                                        'SiteTree.METAEXTRAHELP',
                                        "HTML tags for additional meta information. For example &lt;meta name=\"customName\" content=\"your custom content here\" /&gt;"
                                    )
                                )
                                ->addExtraClass('help')
                            )
        );
        $fields->addFieldsToTab('Root.SEO', array(
                GoogleSuggestField::create("SEOPageSubject", _t('SEO.SEOPageSubjectTitle', 'Subject of this page (required to view this page SEO score)')),
                LiteralField::create('', '<div class="message notice"><p>' .
                    _t(
                        'SEO.SEOSaveNotice',
                        "After making changes save this page to view the updated SEO score"
                    ) . '</p></div>'),
                LiteralField::create('ScoreTitle', '<h4 class="seo_score">' . _t('SEO.SEOScore', 'SEO Score') . '</h4>'),
                LiteralField::create('Score', $this->getHTMLStars()),
                LiteralField::create('ScoreClear', '<div class="score_clear"></div>')
            )
        );

        if ($this->checkPageSubjectDefined()) {
            $fields->addFieldsToTab('Root.SEO', array(
                LiteralField::create('SimplePageSubjectCheckValues', $this->getHTMLSimplePageSubjectTest())
                )
            );
        }

        if ($this->seo_score < 12) {
            $fields->addFieldsToTab('Root.SEO', array(
                LiteralField::create('ScoreTipsTitle', '<h4 class="seo_score">' . _t('SEO.SEOScoreTips', 'SEO Score Tips') . '</h4>'),
                LiteralField::create('ScoreTips', $this->seo_score_tips)
                )
            );
        }


    }
807250
public function updateCMSFields(FieldList $fields)
    {
        $fields->addFieldsToTab(
            'Root.Actions',
            array(
                UploadField::create(
                    'ActionImage',
                    _t('Actions.IMAGE', 'Image')
                ),
                TextareaField::create(
                    'ActionSummary',
                    _t('Actions.SUMMARY', 'Summary')
                )->setRows(3),
                TextField::create(
                    'ActionLabel',
                    _t('Actions.LABEL', 'More')
                )
            )
        );
        return $fields;
    }
830926
public function generateCMSFields(FieldList $fields)
    {
        /** @var News $owner */
        $owner = $this->owner;
        /** @var SiteConfig $siteConfig */
        $siteConfig = SiteConfig::current_site_config();
        $this->type_array = array(
            'news' => _t('News.NEWSITEMTYPE', 'Newsitem'),
        );
        /** Setup all fields according. Their visibility is based on the origin, which can be read from the functionname and comments. */
        $this->defaultFields();
        $this->multipleNewsHolderPages();
        $this->siteConfigFields($owner, $siteConfig);
        $this->existingItem($owner, $siteConfig);
        $this->displayLogic();
        $this->createHelptab();
        if (count($this->type_array) > 1) {
            $this->field_list['Root.Main'][3] = OptionsetField::create('Type', $owner->fieldLabel('Type'), $this->type_array, $owner->Type);
        }
        $this->setupFields($owner, $fields);
    }
157331
public function setFields($fields)
    {
        foreach ($fields as $name => $value) {
            $this->parameters->addPost($name, $value);
        }
    }
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;
    }
638747
public function updateCMSFields(FieldList $fields)
    {
        // Insert Meta Tab:
        
        $fields->insertAfter(
            Tab::create(
                'Meta',
                $this->owner->getMetaTabTitle()
            ),
            'Main'
        );
        
        // Iterate Meta Field Configuration:
        
        foreach ($this->owner->getMetaFieldConfig() as $name => $spec) {
            
            if ($spec) {
                
                // Initialise:
                
                $params = [];
                $before = null;
                $method = "getMeta{$name}Fields";
                
                // Determine Specification Type:
                
                if (is_array($spec)) {
                    $tab    = isset($spec['tab'])    ? $spec['tab']    : 'Root.Meta';
                    $method = isset($spec['method']) ? $spec['method'] : "getMeta{$name}Fields";
                    $before = isset($spec['before']) ? $spec['before'] : null;
                    $params = isset($spec['params']) ? $spec['params'] : [];
                } else {
                    $tab = $spec;
                }
                
                // Add Fields to Specified Tab:
                
                if ($this->owner->hasMethod($method)) {
                    $fields->addFieldsToTab($tab, $this->owner->$method($params), $before);
                }
                
            }
            
        }
        
        // Remove Meta Tab (if empty):
        
        if (!$fields->fieldByName('Root.Meta')->getChildren()->exists()) {
            $fields->removeFieldFromTab('Root', 'Meta');
        }
    }
188635
public function updateFormFields(FieldList $fields, $controller, $formName, $context)
    {
        $image = isset($context['Record']) ? $context['Record'] : null;
        if ($image && $image->appCategory() === 'image') {
            $fields->insertAfter(
                'Title',
                FocusPointField::create('FocusPoint', $image->fieldLabel('FocusPoint'), $image)
                    ->setReadonly($formName === 'fileSelectForm')
            );
        }
    }