If there isn't a capistrano env project folder, show options to create one

@param FieldList $fields
184093
public function setCreateProjectFolderField(&$fields) {
		// Check if the capistrano project folder exists
		if(!$this->Name) {
			return;
		}

		if($this->projectFolderExists()) {
			return;
		}

		$createFolderNotice = new LabelField('CreateEnvFolderNotice', 'Warning: No Capistrano project folder exists');
		$createFolderNotice->addExtraClass('message warning');
		$fields->insertBefore($createFolderNotice, 'Name');
		$createFolderField = new CheckboxField('CreateEnvFolder', 'Create folder');
		$createFolderField->setDescription('Would you like to create the capistrano project folder?');
		$fields->insertAfter($createFolderField, 'CreateEnvFolderNotice');
	}
806761
public function updateCMSFields(FieldList $fields)
    {
        // Remove all Meta fields
        $fields->removeByName('Metadata');
        // Add summary fields
        $fields->addFieldToTab('Root.Main', TextAreaField::create('MetaDescription', _t('JonoM\ShareCare\ShareCareSummary.SummaryTitle','Content summary'))
            ->setDescription(_t('JonoM\ShareCare\ShareCareSummary.SummaryDescription','Summarise the content of this page. This will be used for search engine results and social media so make it enticing.'))
            ->setAttribute('placeholder', $this->owner->getDefaultOGDescription())
            ->setRows(2), 'Content');
        $imgFieldDescription = _t('JonoM\ShareCare\ShareCareSummary.ImageDescription','Choose an image to represent this page in listings and on social media.');
        if (!$this->owner->MetaImageID && $this->owner->isPublished()) {
            $imgFieldDescription .= " <i style=\"color:#ec720f\">" . _t('JonoM\ShareCare\ShareCareSummary.ImageDescriptionNotEmpty','For best results, please don\'t leave this empty.') . "</i>";
        }
        $fields->addFieldToTab('Root.Main', UploadField::create('MetaImage', _t('JonoM\ShareCare\ShareCareSummary.ImageTitle','Summary image'))
            ->setAllowedFileCategories('image')
            ->setAllowedMaxFileNumber(1)
            ->setDescription($imgFieldDescription), 'Content');
    }
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');
            }
        }
    }
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'))
                ]
            )
        );
    }
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;
    }
170422
private void populateSortedCustomFieldsList ()
   {
      m_sortedCustomFieldsList = new ArrayList<CustomField>();
      for (CustomField field : m_projectFile.getCustomFields())
      {
         FieldType fieldType = field.getFieldType();
         if (fieldType != null)
         {
            m_sortedCustomFieldsList.add(field);
         }
      }

      // Sort to ensure consistent order in file
      Collections.sort(m_sortedCustomFieldsList, new Comparator<CustomField>()
      {
         @Override public int compare(CustomField customField1, CustomField customField2)
         {
            FieldType o1 = customField1.getFieldType();
            FieldType o2 = customField2.getFieldType();
            String name1 = o1.getClass().getSimpleName() + "." + o1.getName() + " " + customField1.getAlias();
            String name2 = o2.getClass().getSimpleName() + "." + o2.getName() + " " + customField2.getAlias();
            return name1.compareTo(name2);
         }
      });
   }
235903
public function updateCMSFields(FieldList $fields) {
		$excluded = $this->owner->getExcludedSiteTreeClassNames();
		if(!empty($excluded)) {
			$pages = SiteTree::get()->filter(array(
				'ParentID' => $this->owner->ID,
				'ClassName' => $excluded
			));
			$gridField = new GridField(
				"ChildPages",
				$this->getLumberjackTitle(),
				$pages,
				GridFieldConfig_Lumberjack::create()
			);

			$tab = new Tab('ChildPages', $this->getLumberjackTitle(), $gridField);
			$fields->insertAfter($tab, 'Main');
		}
	}
182312
public function updateCMSFields(FieldList $fields)
    {
        // Create Moderno Tab Set:
        
        $fields->addFieldToTab(
            'Root',
            TabSet::create(
                'Moderno',
                _t('ModernoConfigExtension.MODERNO', 'Moderno')
            )
        );
        
        // Create Colors Tab:
        
        $fields->findOrMakeTab('Root.Moderno.Colors', _t('ModernoConfigExtension.COLORS', 'Colors'));
        
        // Create Colors Fields:
        
        $fields->addFieldsToTab(
            'Root.Moderno.Colors',
            array(
                ColorField::create(
                    'ModernoHighlightColor',
                    _t('ModernoConfigExtension.HIGHLIGHTCOLOR', 'Highlight color')
                ),
                ColorField::create(
                    'ModernoLogoBkgColor',
                    _t('ModernoConfigExtension.LOGOBACKGROUNDCOLOR', 'Logo background color')
                ),
                ColorField::create(
                    'ModernoLinkColor',
                    _t('ModernoConfigExtension.LINKCOLOR', 'Link color')
                ),
                ColorField::create(
                    'ModernoProfileLinkColor',
                    _t('ModernoConfigExtension.PROFILELINKCOLOR', 'Profile link color')
                )
            )
        );
        
        // Create Branding Tab:
        
        $fields->findOrMakeTab('Root.Moderno.Branding', _t('ModernoConfigExtension.BRANDING', 'Branding'));
        
        // Create Branding Fields:
        
        $fields->addFieldsToTab(
            'Root.Moderno.Branding',
            array(
                TextField::create(
                    'ModernoApplicationName',
                    _t('ModernoConfigExtension.APPLICATIONNAME', 'Application name')
                ),
                TextField::create(
                    'ModernoApplicationLink',
                    _t('ModernoConfigExtension.APPLICATIONLINK', 'Application link')
                ),
                ToggleCompositeField::create(
                    'ModernoLogoToggle',
                    _t('ModernoConfigExtension.LOGOIMAGETOGGLETITLE', 'Logo Image'),
                    array(
                        UploadField::create(
                            'ModernoLogoImage',
                            _t('ModernoConfigExtension.LOGOIMAGE', 'Logo image')
                        )->setAllowedFileCategories('image')->setFolderName(self::get_asset_path()),
                        FieldGroup::create(
                            _t('ModernoConfigExtension.DIMENSIONSINPIXELS', 'Dimensions (in pixels)'),
                            array(
                                TextField::create('ModernoLogoImageWidth', '')->setAttribute(
                                    'placeholder',
                                    _t('ModernoConfigExtension.WIDTH', 'Width')
                                ),
                                LiteralField::create('ModernoLogoImageBy', '<i class="fa fa-times by"></i>'),
                                TextField::create('ModernoLogoImageHeight', '')->setAttribute(
                                    'placeholder',
                                    _t('ModernoConfigExtension.HEIGHT', 'Height')
                                )
                            )
                        ),
                        DropdownField::create(
                            'ModernoLogoImageResize',
                            _t('ModernoConfigExtension.RESIZEMETHOD', 'Resize method'),
                            self::get_resize_methods()
                        )->setEmptyString(' '),
                        CheckboxField::create(
                            'ModernoHideSiteName',
                            _t('ModernoConfigExtension.HIDESITENAME', 'Hide site name')
                        ),
                        CheckboxField::create(
                            'ModernoSupportRetina',
                            _t('ModernoConfigExtension.SUPPORTRETINADEVICES', 'Support Retina devices')
                        )
                    )
                ),
                ToggleCompositeField::create(
                    'ModernoLoadingToggle',
                    _t('ModernoConfigExtension.LOADINGIMAGETOGGLETITLE', 'Loading Image'),
                    array(
                        UploadField::create(
                            'ModernoLoadingImage',
                            _t('ModernoConfigExtension.LOADINGIMAGE', 'Loading image')
                        )->setAllowedFileCategories('image')->setFolderName(self::get_asset_path()),
                        FieldGroup::create(
                            _t('ModernoConfigExtension.DIMENSIONSINPIXELS', 'Dimensions (in pixels)'),
                            array(
                                TextField::create('ModernoLoadingImageWidth', '')->setAttribute(
                                    'placeholder',
                                    _t('ModernoConfigExtension.WIDTH', 'Width')
                                ),
                                LiteralField::create('ModernoLoadingImageBy', '<i class="fa fa-times by"></i>'),
                                TextField::create('ModernoLoadingImageHeight', '')->setAttribute(
                                    'placeholder',
                                    _t('ModernoConfigExtension.HEIGHT', 'Height')
                                )
                            )
                        ),
                        DropdownField::create(
                            'ModernoLoadingImageResize',
                            _t('ModernoConfigExtension.RESIZEMETHOD', 'Resize method'),
                            self::get_resize_methods()
                        )->setEmptyString(' ')
                    )
                )
            )
        );
    }
297916
public function addCachedField($arFieldList)
    {
        if (empty($arFieldList)) {
            return;
        }

        if (empty($this->cached) || !is_array($this->cached)) {
            $this->cached = [];
        }

        if (is_string($arFieldList)) {
            $arFieldList = [$arFieldList];
        }

        $this->cached = array_merge($this->cached, $arFieldList);
        $this->cached = array_unique($this->cached);
    }
476866
public function updateCMSFields(FieldList $fields) {
		$fields->addFieldsToTab(
			'Root.Mobile',
			array(
				OptionsetField::create('MobileSiteType', _t('MobileSiteConfig.MOBILESITEBEHAVIOUR', 'Mobile site behaviour'), $this->getMobileSiteTypes()),
				TextField::create('MobileDomain', _t('MobileSiteConfig.MOBILEDOMAIN', 'Mobile domain <small>(e.g. m.mysite.com, needs to be different from "Full site domain")</small>')),
				TextField::create('FullSiteDomain', _t('MobileSiteConfig.FULLSITEDOMAIN', 'Full site domain <small>(e.g. mysite.com, usually doesn\'t need to be changed)</small>')),
				DropdownField::create('MobileTheme', _t('MobileSiteConfig.MOBILETHEME', 'Mobile theme'), $this->owner->getAvailableThemes())
					->setEmptyString(_t('SiteConfig.DEFAULTTHEME', '(Use default theme)'))
			)
		);
	}
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);
            }
        }
    }
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')
                    ]
                )
            ]
        );
    }
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;"
                ))
            );
        }
    }
541887
public function updateCMSFields(FieldList $fields)
    {
        $fields->addFieldToTab(
            'Root.MFA',
            $checkbox = CheckboxField::create(
                'EnforceMFA',
                _t(self::class . '.ENFORCEMFA', 'Enforce MFA on all users'),
                $this->isMFAEnforced()
            )
        );
        $checkbox->setDescription(null);

        $this->updateCheckboxDescription($fields);
    }
251029
public function updateSettingsFields(FieldList $fields)
    {
        // Define Placeholder:
        
        $placeholder = _t(__CLASS__ . '.DROPDOWNDEFAULT', '(default)');
        
        // Create Settings Fields:
        
        $fields->addFieldToTab(
            'Root.Settings',
            FieldSection::create(
                'AppearanceSettings',
                $this->owner->fieldLabel('AppearanceSettings'),
                [
                    $template = DropdownField::create(
                        'MyTemplateID',
                        $this->owner->fieldLabel('MyTemplateID'),
                        Template::get()->map()
                    )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder),
                    $layout = DropdownField::create(
                        'MyLayoutID',
                        $this->owner->fieldLabel('MyLayoutID'),
                        Layout::get()->map()
                    )->setEmptyString(' ')->setAttribute('data-placeholder', $placeholder)
                ]
            )
        );
        
        // Check Permissions and Modify Fields:
        
        if (!Permission::check(['ADMIN', 'SILVERWARE_PAGE_TEMPLATE_CHANGE'])) {
            $fields->makeFieldReadonly($template);
        }
        
        if (!Permission::check(['ADMIN', 'SILVERWARE_PAGE_TEMPLATE_CHANGE'])) {
            $fields->makeFieldReadonly($layout);
        }
    }
1188412
protected function getProductFields(FieldList $fields)
    {
        //Requirements::javascript('dynamic/foxystripe: client/dist/javascript/scripts.min.js');
        $hiddenTitle = ($this->product->ReceiptTitle) ?
            htmlspecialchars($this->product->ReceiptTitle) :
            htmlspecialchars($this->product->Title);
        $code = $this->product->Code;

        if ($this->getProduct()->getIsAvailable()) {
            $fields->push(
                HiddenField::create('name')
                    ->setValue(
                        ProductPage::getGeneratedValue($code, 'name', $hiddenTitle, 'value')
                    )
            );
            $fields->push(
                HiddenField::create('category')
                    ->setValue(
                        ProductPage::getGeneratedValue($code, 'category', $this->product->Category()->Code, 'value')
                    )
            );
            $fields->push(
                HiddenField::create('code')
                    ->setValue(
                        ProductPage::getGeneratedValue($code, 'code', $this->product->Code, 'value')
                    )
            );
            $fields->push(
                HiddenField::create(
                    'product_id'
                )->setValue(
                    ProductPage::getGeneratedValue($code, 'product_id', $this->product->ID, 'value')
                )
            );
            $fields->push(
                HiddenField::create('price')
                    ->setValue(
                        ProductPage::getGeneratedValue($code, 'price', $this->product->Price, 'value')
                    )
            );//can't override id
            if ($this->product->Weight > 0) {
                $fields->push(
                    HiddenField::create('weight')
                        ->setValue(
                            ProductPage::getGeneratedValue($code, 'weight', $this->product->Weight, 'value')
                        )
                );
            }

            $image = null;
            if ($this->product->Image() || ProductPage::has_extension(ProductPageLegacy::class)) {
                if ($this->product->Image()) {
                    $image = $this->product->Image()->Pad(80, 80)->absoluteURL;
                } elseif (ProductPage::has_extension(ProductPageLegacy::class) &&
                    $this->product->PreviewImage()->exists()) {
                    $image = $this->product->PreviewImage()->Pad(80, 80)->absoluteURL;
                }

                if ($image) {
                    $fields->push(
                        HiddenField::create('image')
                            ->setValue(
                                ProductPage::getGeneratedValue($code, 'image', $image, 'value')
                            )
                    );
                }
            }

            $optionsSet = $this->getProductOptionSet();
            $fields->push($optionsSet);

            $quantityMax = ($this->site_config->MaxQuantity) ? $this->site_config->MaxQuantity : 10;

            $fields->push(QuantityField::create('x:visibleQuantity')->setTitle('Quantity')->setValue(1));
            $fields->push(
                HiddenField::create('quantity')
                    ->setValue(
                        ProductPage::getGeneratedValue($code, 'quantity', 1, 'value')
                    )
            );

            $fields->push(
                HeaderField::create('submitPrice', '$' . $this->product->Price, 4)
                    ->addExtraClass('submit-price')
            );
            $fields->push(
                $unavailable = HeaderField::create('unavailableText', 'Selection unavailable', 4)
                    ->addExtraClass('unavailable-text')
            );

            if (!empty(trim($this->getSiteConfig()->StoreName)) && $this->getProduct()->getIsAvailable()) {
                $unavailable->addExtraClass('hidden');
            }

            $this->extend('updatePurchaseFormFields', $fields);
        } else {
            $fields->push(HeaderField::create('unavailableText', 'Currently Out of Stock', 4));
        }

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

        return $fields;
    }
405822
protected function checkProjectPath() {
		// Create the project capistrano folder
		if($this->CreateEnvFolder && !file_exists($this->getProjectFolderPath())) {
			mkdir($this->DNData()->getEnvironmentDir().'/'.$this->Name);
		}
	}