code/EditableSpamProtectionField.php
public function getCMSFields()
    {
        /** @var FieldList $fields */
        $fields = parent::getCMSFields();

        // Get protector
        $protector = FormSpamProtectionExtension::get_protector();
        if (!$protector) {
            return $fields;
        }

        if ($this->Parent()->Fields() instanceof UnsavedRelationList) {
            return $fields;
        }

        // Each other text field in this group can be assigned a field mapping
        $mapGroup = FieldGroup::create()
            ->setTitle(_t(__CLASS__.'.SPAMFIELDMAPPING', 'Spam Field Mapping'))
            ->setName('SpamFieldMapping')
            ->setDescription(_t(
                __CLASS__.'.SPAMFIELDMAPPINGDESCRIPTION',
                'Select the form fields that correspond to any relevant spam protection identifiers'
            ));

        // Generate field specific settings
        $mappableFields = FormSpamProtectionExtension::config()->get('mappable_fields');
        $mappableFieldsMerged = array_combine($mappableFields, $mappableFields);
        foreach ($this->getCandidateFields() as $otherField) {
            $mapSetting = "Map-{$otherField->Name}";
            $fieldOption = DropdownField::create(
                'spammap-' . $mapSetting,
                $otherField->Title,
                $mappableFieldsMerged,
                $this->spamMapValue($mapSetting)
            )->setEmptyString('');
            $mapGroup->push($fieldOption);
        }
        $fields->addFieldToTab('Root.Main', $mapGroup);

        return $fields;
    }
public function getCMSFields()
    {
        /** @var FieldList $fields */
        $fields = parent::getCMSFields();

        // Get protector
        $protector = FormSpamProtectionExtension::get_protector();
        if (!$protector) {
            return $fields;
        }

        if ($this->Parent()->Fields() instanceof UnsavedRelationList) {
            return $fields;
        }

        // Each other text field in this group can be assigned a field mapping
        $mapGroup = FieldGroup::create()
            ->setTitle(_t(__CLASS__.'.SPAMFIELDMAPPING', 'Spam Field Mapping'))
            ->setName('SpamFieldMapping')
            ->setDescription(_t(
                __CLASS__.'.SPAMFIELDMAPPINGDESCRIPTION',
                'Select the form fields that correspond to any relevant spam protection identifiers'
            ));

        // Generate field specific settings
        $mappableFields = FormSpamProtectionExtension::config()->get('mappable_fields');
        $mappableFieldsMerged = array_combine($mappableFields, $mappableFields);
        foreach ($this->getCandidateFields() as $otherField) {
            $mapSetting = "Map-{$otherField->Name}";
            $fieldOption = DropdownField::create(
                'spammap-' . $mapSetting,
                $otherField->Title,
                $mappableFieldsMerged,
                $this->spamMapValue($mapSetting)
            )->setEmptyString('');
            $mapGroup->push($fieldOption);
        }
        $fields->addFieldToTab('Root.Main', $mapGroup);

        return $fields;
    }
public function getCMSFields ( ) { /** @var FieldList $fields */ $ fields = parent :: getCMSFields ( ) ; // Get protector $ protector = FormSpamProtectionExtension :: get_protector ( ) ; if ( ! $ protector ) { return $ fields ; } if ( $ this -> Parent ( ) -> Fields ( ) instanceof UnsavedRelationList ) { return $ fields ; } // Each other text field in this group can be assigned a field mapping $ mapGroup = FieldGroup :: create ( ) -> setTitle ( _t ( __CLASS__ . '.SPAMFIELDMAPPING' , 'Spam Field Mapping' ) ) -> setName ( 'SpamFieldMapping' ) -> setDescription ( _t ( __CLASS__ . '.SPAMFIELDMAPPINGDESCRIPTION' , 'Select the form fields that correspond to any relevant spam protection identifiers' ) ) ; // Generate field specific settings $ mappableFields = FormSpamProtectionExtension :: config ( ) -> get ( 'mappable_fields' ) ; $ mappableFieldsMerged = array_combine ( $ mappableFields , $ mappableFields ) ; foreach ( $ this -> getCandidateFields ( ) as $ otherField ) { $ mapSetting = "Map-{$otherField->Name}" ; $ fieldOption = DropdownField :: create ( 'spammap-' . $ mapSetting , $ otherField -> Title , $ mappableFieldsMerged , $ this -> spamMapValue ( $ mapSetting ) ) -> setEmptyString ( '' ) ; $ mapGroup -> push ( $ fieldOption ) ; } $ fields -> addFieldToTab ( 'Root.Main' , $ mapGroup ) ; return $ fields ; }
Used in userforms 3.x and above

{@inheritDoc}
Used in userforms 3 . x and above