Version: current

     1 <?php
     2
     3 /**
     4  * Editable Spam Protecter Field. Used with the User Defined Forms module (if
     5  * installed) to allow the user to have captcha fields with their custom forms
     6  *
     7  * @package spamprotection
     8  */
     9
    10 class EditableSpamProtectionField extends EditableFormField {
    11
    12     static $singular_name = 'Spam Protection Field';
    13
    14     static $plural_name = 'Spam Protection Fields';
    15
    16     function onBeforeWrite() {
    17         parent::onBeforeWrite();
    18         $this->Required = 0;
    19     }
    20
    21     public function getFieldConfiguration() {
    22         $options = parent::getFieldConfiguration();
    23         $options->removeByName("Fields[$this->ID][CustomSettings][Placeholder]");
    24         return $options;
    25     }
    26
    27     public function getFieldValidationOptions() {
    28         return false;
    29     }
    30
    31     function getFormField() {
    32         if($protector = SpamProtectorManager::get_spam_protector()) {
    33             if($protector) {
    34                 $protector = new $protector();
    35                 return $protector->getFormField($this->Name, $this->Title, null);
    36             }
    37         }
    38         return false;
    39     }
    40
    41     public function Icon() {
    42         return 'spamprotection/images/' . strtolower($this->class) . '.png';
    43     }
    44
    45     function showInReports() {
    46         return false;
    47     }
    48 }
    49

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -