1 | <?php |
||
10 | class EditableSpamProtectionField extends EditableFormField |
||
|
|||
11 | { |
||
12 | private static $singular_name = 'Spam Protection Field'; |
||
13 | |||
14 | private static $plural_name = 'Spam Protection Fields'; |
||
15 | /** |
||
16 | * Fields to include spam detection for |
||
17 | * |
||
18 | * @var array |
||
19 | * @config |
||
20 | */ |
||
21 | private static $check_fields = array( |
||
22 | 'EditableEmailField', |
||
23 | 'EditableTextField', |
||
24 | 'EditableNumericField' |
||
25 | ); |
||
26 | |||
27 | private static $db = array( |
||
28 | 'SpamFieldSettings' => 'Text' |
||
29 | ); |
||
30 | |||
31 | /** |
||
32 | * @var FormField |
||
33 | */ |
||
34 | protected $formField = null; |
||
35 | |||
36 | public function getFormField() |
||
60 | |||
61 | /** |
||
62 | * @param FormField $field |
||
63 | * @return self |
||
64 | */ |
||
65 | public function setFormField(FormField $field) |
||
71 | |||
72 | /** |
||
73 | * Gets the list of all candidate spam detectable fields on this field's form |
||
74 | * |
||
75 | * @return DataList |
||
76 | */ |
||
77 | protected function getCandidateFields() |
||
95 | |||
96 | /** |
||
97 | * This method is in place for userforms 2.x |
||
98 | * |
||
99 | * @deprecated 3.0 Please use {@link getCMSFields()} instead |
||
100 | */ |
||
101 | public function getFieldConfiguration() |
||
105 | |||
106 | /** |
||
107 | * Write the spam field mapping values to a serialised DB field |
||
108 | * |
||
109 | * {@inheritDoc} |
||
110 | */ |
||
111 | public function onBeforeWrite() |
||
127 | |||
128 | /** |
||
129 | * Used in userforms 3.x and above |
||
130 | * |
||
131 | * {@inheritDoc} |
||
132 | */ |
||
133 | public function getCMSFields() |
||
174 | |||
175 | /** |
||
176 | * Try to retrieve a value for the given spam field map name from the serialised data |
||
177 | * |
||
178 | * @param string $mapSetting |
||
179 | * @return string |
||
180 | */ |
||
181 | public function spamMapValue($mapSetting) |
||
193 | |||
194 | /** |
||
195 | * Using custom validateField method |
||
196 | * as Spam Protection Field implementations may have their own error messages |
||
197 | * and may not be based on the field being required, e.g. Honeypot Field |
||
198 | * |
||
199 | * @param array $data |
||
200 | * @param Form $form |
||
201 | * @return void |
||
202 | */ |
||
203 | public function validateField($data, $form) |
||
237 | |||
238 | public function getFieldValidationOptions() |
||
242 | |||
243 | public function getRequired() |
||
247 | |||
248 | public function getIcon() |
||
252 | |||
253 | public function showInReports() |
||
257 | } |
||
258 | } |
||
259 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.