2014-02-10 08:53:59 +01:00
|
|
|
<?php
|
2017-08-28 00:53:32 +02:00
|
|
|
|
|
|
|
namespace SilverStripe\SpamProtection;
|
2016-10-10 07:44:28 +02:00
|
|
|
|
|
|
|
use SilverStripe\Forms\FormField;
|
2014-02-10 08:53:59 +01:00
|
|
|
|
|
|
|
/**
|
2017-07-07 04:23:01 +02:00
|
|
|
* SpamProtector base interface.
|
2014-02-10 08:53:59 +01:00
|
|
|
*
|
|
|
|
* All Protectors are required implement this interface if they want to appear
|
|
|
|
* on the form.
|
|
|
|
*
|
|
|
|
* Classes with this interface are used to generate helper lists to allow the
|
|
|
|
* user to select the protector.
|
2017-07-07 04:23:01 +02:00
|
|
|
*
|
2014-02-10 08:53:59 +01:00
|
|
|
* @package spamprotection
|
|
|
|
*/
|
|
|
|
|
2015-11-21 07:15:15 +01:00
|
|
|
interface SpamProtector
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Return the {@link FormField} associated with this protector.
|
|
|
|
*
|
2017-07-07 04:23:01 +02:00
|
|
|
* Most spam methods will simply return a piece of HTML to be injected at
|
2015-11-21 07:15:15 +01:00
|
|
|
* the end of the form. If a spam method needs to inject more than one
|
2017-07-07 04:23:01 +02:00
|
|
|
* form field (i.e a hidden field and a text field) then return a
|
2015-11-21 07:15:15 +01:00
|
|
|
* {@link FieldGroup} from this method to include both.
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @param string $title
|
|
|
|
* @param mixed $value
|
|
|
|
* @return FormField The resulting field
|
|
|
|
*/
|
|
|
|
public function getFormField($name = null, $title = null, $value = null);
|
2014-02-18 04:19:29 +01:00
|
|
|
|
2015-11-21 07:15:15 +01:00
|
|
|
/**
|
|
|
|
* Set the fields to map spam protection too
|
|
|
|
*
|
|
|
|
* @param array $fieldMapping array of Field Names, where the indexes of the array are
|
|
|
|
* the field names of the form and the values are the standard spamprotection
|
|
|
|
* fields used by the protector
|
|
|
|
*/
|
|
|
|
public function setFieldMapping($fieldMapping);
|
2014-02-18 04:19:29 +01:00
|
|
|
}
|