KaufmannDigital / KaufmannDigital.GDPR.CookieConsent

A ready-to-run package, that integrates an advanced cookie consent banner into your Neos CMS site.
https://www.kaufmann.digital/neos-cms/plugins/dsgvo-gdpr-cookie-consent
GNU General Public License v3.0
26 stars 11 forks source link

Get dimension values from site context #25

Closed heoehmke closed 3 years ago

heoehmke commented 3 years ago

As described in #23, we also noticed the cookie banner didn't consider dimensions anymore. I tested the bugfix from #24, which unfortunately doesn't work for us. The /api/kd-gdpr-cc route is always called with the default dimension value (language=en in our case), so the cookie banner always shows in english, even if we're on the german page.

I took some time to debug, and maybe we have messed up our content repository, but calling site.dimensions here doesn't consider the current dimension and always returns the default dimension value: https://github.com/KaufmannDigital/KaufmannDigital.GDPR.CookieConsent/blob/ae3553a2fdddac9cef726778ebe2b02a77854629/Resources/Private/Fusion/Root.fusion#L12

On the other hand calling site.context.dimensions returns the correct dimension value with the fallback dimension value. As this part of neos isn't documented very well I'm not sure if that's the right way, but I saw other places in the neos codebase where dimension values are retrieved by calling site.context.dimensions rather than site.dimensions

Nikdro commented 3 years ago

Great research, thank you very much @heoehmke!

I wondered a bit, cause on our multi-language websites this worked perfect so far. But we've no fallbacks defined here. Maybe that's a difference.
I tried your fix with one of our projects and it worked as before and as expected. So if this works for you on others, fine 🙂

Nikdro commented 3 years ago

Released in 2.2.5 and 3.0.4