Allow question prefix to be replaced

This commit is contained in:
Will Rossiter 2014-11-05 15:52:42 +13:00
parent bd581c7f7c
commit ae63604f08

View File

@ -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()
); );
} }