mirror of
https://github.com/silverstripe/silverstripe-mathspamprotection
synced 2024-10-22 08:05:52 +02:00
Allow question prefix to be replaced
This commit is contained in:
parent
bd581c7f7c
commit
ae63604f08
@ -14,6 +14,13 @@ class MathSpamProtectorField extends TextField {
|
|||||||
* @var bool $enabled
|
* @var bool $enabled
|
||||||
*/
|
*/
|
||||||
private static $enabled = true;
|
private static $enabled = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @config
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
private static $question_prefix;
|
||||||
|
|
||||||
public function Field($properties = array()) {
|
public function Field($properties = array()) {
|
||||||
if(Config::inst()->get('MathSpamProtectorField', 'enabled')) {
|
if(Config::inst()->get('MathSpamProtectorField', 'enabled')) {
|
||||||
@ -37,8 +44,14 @@ class MathSpamProtectorField extends TextField {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function Title() {
|
public function Title() {
|
||||||
|
$prefix = Config::inst()->get('MathSpamProtection', 'question_prefix');
|
||||||
|
|
||||||
|
if(!$prefix) {
|
||||||
|
$prefix = _t('MathSpamProtectionField.SPAMQUESTION', "Spam protection question: %s");
|
||||||
|
}
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
_t('MathSpamProtectionField.SPAMQUESTION', "Spam protection question: %s"),
|
$prefix,
|
||||||
self::get_math_question()
|
self::get_math_question()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user