silverstripe-terraformers / silverstripe-embargo-expiry

BSD 3-Clause "New" or "Revised" License
7 stars 7 forks source link

getEmbargoExpiryFieldNoticeMessage appears to be called twice #90

Closed oddnoc closed 2 years ago

oddnoc commented 2 years ago

The messages from getEmbargoExpiryFieldNoticeMessage (and others) show up twice in the CMS, as shown below. I confirmed that the method is actually called twice by making a local modification to add a static counter to the method (not shown, but easy to reproduce). However, I couldn't find where the second call is coming from.

image
chrispenny commented 2 years ago

Thank you for raising this!

Can you please share how you have applied the extensions, what version you are using, and any other info that might be useful in tracking down the issue?

This isn't something I've come across before, but perhaps we could chuck some logic in to check if the fields already exist before adding them.

Any chance you have extra calls to updateCMSFields() in your project that is triggering fields to be added twice?

Cheers!

oddnoc commented 2 years ago

That was it -- there was an extra call to $this->extend('updateCMSFields', $fields) in Page's getCMSFields. The person coding it hadn't realised that SiteTree already does so.

chrispenny commented 2 years ago

Sweet!

Would you be happy for me to close this issue?