studiobonito / silverstripe-spamprotection-honeypot

Provide Honeypot spam protection for SilverStripe CMS.
Other
7 stars 17 forks source link

Add onBeforeRender extension hook in Field() #10

Closed MrJamesEllis closed 7 years ago

MrJamesEllis commented 7 years ago

Hi

HoneypotField::Field() overrides FormField::Field() but doesn't implement the onBeforeRender extension hook found there.

Could https://github.com/studiobonito/silverstripe-spamprotection-honeypot/blob/master/src/FormField/HoneypotField.php#L67 be updated to include this hook before the fields are created?

e.g

    public function Field($properties = array())
    {
        $this->extend('onBeforeRender', $this);
        return $this->createHoneypotField() . $this->createTimestampField();
    }

This would allow an extension to modify attributes on the two fields return e.g changing the field name property globally via config.

Thanks James

MrJamesEllis commented 7 years ago

Closing, found another way :)