code/EditableSpamProtectionField.php
public function onBeforeWrite()
    {
        $fieldMap = json_decode($this->SpamFieldSettings, true);
        if (empty($fieldMap)) {
            $fieldMap = array();
        }

        foreach ($this->record as $key => $value) {
            if (substr($key, 0, 8) === 'spammap-') {
                $fieldMap[substr($key, 8)] = $value;
            }
        }
        $this->setField('SpamFieldSettings', json_encode($fieldMap));

        return parent::onBeforeWrite();
    }
public function onBeforeWrite()
    {
        $fieldMap = json_decode($this->SpamFieldSettings, true);
        if (empty($fieldMap)) {
            $fieldMap = array();
        }

        foreach ($this->record as $key => $value) {
            if (substr($key, 0, 8) === 'spammap-') {
                $fieldMap[substr($key, 8)] = $value;
            }
        }
        $this->setField('SpamFieldSettings', json_encode($fieldMap));

        return parent::onBeforeWrite();
    }
public function onBeforeWrite ( ) { $ fieldMap = json_decode ( $ this -> SpamFieldSettings , true ) ; if ( empty ( $ fieldMap ) ) { $ fieldMap = array ( ) ; } foreach ( $ this -> record as $ key => $ value ) { if ( substr ( $ key , 0 , 8 ) === 'spammap-' ) { $ fieldMap [ substr ( $ key , 8 ) ] = $ value ; } } $ this -> setField ( 'SpamFieldSettings' , json_encode ( $ fieldMap ) ) ; return parent :: onBeforeWrite ( ) ; }
Write the spam field mapping values to a serialised DB field

{@inheritDoc}
Write the spam field mapping values to a serialised DB field