Add subsites-specific fields to the folder editor.
@param FieldList $fields
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>'
            ));
        }
    }
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);
    }
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;
    }
41179
public function updateCMSFields(FieldList $fields) {
        $kapostRefID=$this->owner->KapostRefID;
        if(!empty($kapostRefID)) {
            if(CMSPageEditController::has_extension('KapostPageEditControllerExtension')) {
                $messageContent=_t('KapostSiteTreeExtension.KAPOST_CONTENT_WARNING_RO', '_This Page\'s content is being populated by Kapost, some fields are not editable.');
            }else {
                $messageContent=_t('KapostSiteTreeExtension.KAPOST_CONTENT_WARNING', '_This Page\'s content is being populated by Kapost.');
            }
            
            
            //Edit in kapost link
            $kapostBase=KapostAdmin::config()->kapost_base_url;
            if(!empty($kapostBase)) {
                $messageContent.=' <a href="'.Controller::join_links($kapostBase, 'posts', $kapostRefID).'" target="_blank">'._t('KapostSiteTreeExtension.KAPOST_CONTENT_EDIT_LABEL', '_Click here to edit in Kapost').'</a>';
            }
            
            
            $fields->insertBefore(new LiteralField('KapostContentWarning', '<div class="message warning">'.$messageContent.'</div>'), 'Title');
            
            
            //Detect Incoming Changes
            if(Permission::check('CMS_ACCESS_KapostAdmin')) {
                $incoming=KapostObject::get()->filter('IsKapostPreview', 0)->filter('KapostRefID', Convert::raw2sql($kapostRefID));
                if($incoming->count()>=1) {
                    $link=Controller::join_links(AdminRootController::config()->url_base, KapostAdmin::config()->url_segment, 'KapostObject/EditForm/field/KapostObject/item', $incoming->first()->ID, 'edit');
                    
                    $messageContent=_t('KapostSiteTreeExtension.KAPOST_INCOMING', '_There are incoming changes from Kapost waiting for this page.').' '.
                                    '<a href="'.$link.'" class="cms-panel-link">'._t('KapostSiteTreeExtension.KAPOST_INCOMING_VIEW', '_Click here to view the changes').'</a>';
                    
                    $fields->insertBefore(new LiteralField('KapostIncomingWarning', '<div class="message warning">'.$messageContent.'</div>'), 'Title');
                }
            }
        }
        
        $fields->removeByName('KapostRefID');
    }
276956
public function updateCMSFields(FieldList $fields)
    {
        // Update Field Objects (from parent):
        
        parent::updateCMSFields($fields);
        
        // Create Child Fields:
        
        $children = [];
        
        if (!$this->owner->config()->alignment_style_hide_text) {
            
            $children[] = ViewportsField::create(
                'TextAlignment',
                $this->owner->fieldLabel('TextAlignment'),
                $this->owner->getTextAlignmentOptions()
            );
            
        }
        
        if (!$this->owner->config()->alignment_style_hide_image) {
            
            $children[] = ViewportsField::create(
                'ImageAlignment',
                $this->owner->fieldLabel('ImageAlignment'),
                $this->owner->getImageAlignmentOptions()
            );
            
        }
        
        // Create Style Fields:
        
        if (!empty($children)) {
            
            $fields->addFieldsToTab(
                'Root.Style',
                [
                    $section = FieldSection::create(
                        'AlignmentStyle',
                        $this->owner->fieldLabel('Alignment'),
                        $children
                    )
                ]
            );
            
        }
    }
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');
        }
    }
1054074
public function add($fieldName)
    {
        if (strpos($fieldName, '[') === false && strpos($fieldName, ']') === false && in_array('*', $this->fieldList)) {
            $this->fieldList = array_diff($this->fieldList, ['*']);
        }

        $this->fieldList[] = $fieldName;
    }
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).'
            )
        );
    }
1010241
public function updateCMSFields(FieldList $fields)
    {
        parent::updateCMSFields($fields);

        if (!isset(self::$collectorCache[$this->owner->class])) {
            return;
        }

        // remove all localized fields from the list (generated through scaffolding)
        foreach (self::$collectorCache[$this->owner->class] as $translatableField => $type) {
            $fields->removeByName($translatableField);
        }

        // check if we're in a translation
        if (Translatable::default_locale() != Translatable::get_current_locale()) {
            /** @var TranslatableFormFieldTransformation $transformation */
            $transformation = TranslatableFormFieldTransformation::create($this->owner);

            // iterate through all localized fields
            foreach (self::$collectorCache[$this->owner->class] as $translatableField => $type) {
                if (strpos($translatableField, Translatable::get_current_locale())) {
                    $basename = $this->getBasename($translatableField);

                    if ($field = $this->getLocalizedFormField($basename, Translatable::default_locale())) {
                        $fields->replaceField($basename, $transformation->transformFormField($field));
                    }
                }
            }
        }
    }
226032
public function updateCMSFields(FieldList $fields)
    {
        $tags = $this->getAllTagsMap();
        $tagField = ListboxField::create('Tags', _t('DMSDocumentTaxonomyExtension.TAGS', 'Tags'))
            ->setMultiple(true)
            ->setSource($tags);

        if (empty($tags)) {
            $tagField->setAttribute('data-placeholder', _t('DMSDocumentTaxonomyExtension.NOTAGS', 'No tags found'));
        }

        $fields->insertAfter('Description', $tagField);
    }
480980
public function addField($fieldName, Field $field)
    {
        $this->fieldNames[ $fieldName ] = $fieldName;
        $this->fields[ $fieldName ]     = $field;

        return $fieldName;
    }
440066
public function updateCMSFields(FieldList $fields)
    {
        $owner = $this->owner;

        // Insert site tree field after the file selection field
        $fields->insertAfter(
            'Type',
            Wrapper::create(
                TreeDropdownField::create(
                    'SiteTreeID',
                    _t(__CLASS__ . '.PAGE', 'Page'),
                    SiteTree::class
                ),
                TextField::create(
                    'Anchor',
                    _t(__CLASS__ . '.ANCHOR', 'Anchor/Querystring')
                )
                ->setDescription(_t(__CLASS__ . '.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')
                ->setDescription(_t(__CLASS__ . '.DELETEDWARNING', 'Warning: The selected page appears to have been deleted or unpublished. This link may not appear or may be broken in the frontend'));
        }
    }
719837
protected function namespaceFields(FieldList $fields, array $context)
    {
        $elementID = $context['Record']->ID;

        foreach ($fields->dataFields() as $field) {
            $namespacedName = sprintf(self::FIELD_NAMESPACE_TEMPLATE, $elementID, $field->getName());
            $field->setName($namespacedName);
        }
    }
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();
      }
   }
136657
public function setFieldList($field_list = array())
    {
        if (empty($field_list)) $this->_field_list = array('*');
        $this->_field_list = (array)$field_list;

        return $this;
    }
952614
public function updateCMSFields(FieldList $fields)
    {
        if (Config::inst()->get(SeoObjectExtension::class, 'use_webmaster_tag')) {
            $fields->addFieldToTab(
                "Root.SEO",
                TextareaField::create(
                    "GoogleWebmasterMetaTag",
                    _t('SEO.SEOGoogleWebmasterMetaTag', 'Google webmaster meta tag')
                )->setRightTitle(_t(
                    'SEO.SEOGoogleWebmasterMetaTagRightTitle',
                    "Full Google webmaster meta tag For example &lt;meta name=\"google-site-verification\" content=\"hjhjhJHG12736JHGdfsdf\" /&gt;"
                ))
            );
        }
    }
1203501
public void addFieldList(FieldList fieldList, int iLocation)
    {
        if (fieldList == null)
            return;
        if (m_vFieldListList == null)
            m_vFieldListList = new Vector<FieldList>();
        for (int i = 0; ; i++)
        {   // Step 1 - Disconnect the controls from the fields
            FieldList fieldInList = this.getFieldList(i);
            if (fieldInList == null)
                break;
            if (fieldList == fieldInList)
                return; // Found, already there.
        }
        if (iLocation == -1)
            m_vFieldListList.add(fieldList);
        else
            m_vFieldListList.add(iLocation, fieldList);
    }