mirror of
https://github.com/silverstripe/silverstripe-spamprotection.git
synced 2024-10-22 14:05:59 +02:00
If no protector is set then skip the form field
This commit is contained in:
parent
05650e912d
commit
949ec2b359
@ -85,10 +85,12 @@ class FormSpamProtectionExtension extends Extension {
|
|||||||
|
|
||||||
// set custom mapping on this form
|
// set custom mapping on this form
|
||||||
$protector = self::get_protector($options);
|
$protector = self::get_protector($options);
|
||||||
|
|
||||||
if(isset($options['mapping'])) {
|
if(isset($options['mapping'])) {
|
||||||
$protector->setFieldMapping($options['mapping']);
|
$protector->setFieldMapping($options['mapping']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($protector) {
|
||||||
// add the form field
|
// add the form field
|
||||||
if($field = $protector->getFormField($name, $title)) {
|
if($field = $protector->getFormField($name, $title)) {
|
||||||
$field->setForm($this->owner);
|
$field->setForm($this->owner);
|
||||||
@ -103,6 +105,7 @@ class FormSpamProtectionExtension extends Extension {
|
|||||||
$this->owner->Fields()->push($field);
|
$this->owner->Fields()->push($field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->owner;
|
return $this->owner;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user