Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Add NullSpamProtector #135

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions _config/spamprotection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: frameworktest-spamprotection
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
default_spam_protector: SilverStripe\FrameworkTest\NullSpamProtector\NullSpamProtector
28 changes: 28 additions & 0 deletions code/null-spam-protector/NullSpamProtector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace SilverStripe\FrameworkTest\NullSpamProtector;

use SilverStripe\Forms\HiddenField;
use SilverStripe\SpamProtection\SpamProtector;

if (!interface_exists(SpamProtector::class)) {
return;
}

/**
* This is a minimum implementation used in CI for silverstripe/spamprotector so there's a default_spam_protector
*
* This used to be done by silverstripe/akismet, but that's no longer being used in CMS 5
*/
class NullSpamProtector implements SpamProtector
GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved
{
public function getFormField($name = null, $title = null, $value = null)
{
return new HiddenField('NullSpamProtector');
}

public function setFieldMapping($fieldMapping)
{
// no-op
}
}