Remove extra conditional by storing the field name in a private static
This commit is contained in:
parent
82271cb1b2
commit
e45082893d
|
@ -41,6 +41,15 @@ class FormSpamProtectionExtension extends Extension
|
|||
'authorId'
|
||||
);
|
||||
|
||||
/**
|
||||
* @config
|
||||
*
|
||||
* The field name to use for the {@link SpamProtector} {@link FormField}
|
||||
*
|
||||
* @var string $spam_protector
|
||||
*/
|
||||
private static $field_name = "Captcha";
|
||||
|
||||
/**
|
||||
* Instantiate a SpamProtector instance
|
||||
*
|
||||
|
@ -74,10 +83,8 @@ class FormSpamProtectionExtension extends Extension
|
|||
// captcha form field name (must be unique)
|
||||
if (isset($options['name'])) {
|
||||
$name = $options['name'];
|
||||
} else if($field_name = Config::inst()->get('FormSpamProtectionExtension', 'field_name')) {
|
||||
$name = $field_name;
|
||||
} else {
|
||||
$name = 'Captcha';
|
||||
$name = Config::inst()->get('FormSpamProtectionExtension', 'field_name');
|
||||
}
|
||||
|
||||
// captcha field title
|
||||
|
|
Loading…
Reference in New Issue