dryven / cookie-byte

Get full control over all your cookie-related settings right in the control panel: Create cookie categories, add code snippets, customise the cookie modal and activate cookie content covers that hide content as long as specific cookie categories are not accepted.
https://statamic.com/addons/dryven/cookie-byte
5 stars 2 forks source link

Depending on `assets` asset container. #31

Closed geertjanknapen1 closed 1 month ago

geertjanknapen1 commented 1 month ago

In light of evolving legislation regarding consent and cookies in the EU, I was tasked with evaluating several add-ons that can address these requirements out of the box or with minimal customization. CookieByte appeared to be a promising option, so I proceeded to install and test it.

Upon following the provided documentation, I encountered an error stating, "The container with the handle assets cannot be found." This error is understandable as our project is highly customized and does not include the specified asset container.

As a developer, I was able to identify the issue and discovered that asset containers can be configured manually using the config. However, this might not be immediately evident to non-developers, potentially leading to confusion.

Additionally, upon further investigation, I found that images are utilized for the cookie_cover tag, which raises the question of why this error occurs when only the cookie_modal tag has been implemented.

While this may not be a significant issue for developers, it is worth noting in the documentation, preferably at the beginning. This is particularly important as I was also unable to access the CookieByte menu item in the control panel.

TL;DR;

Your code relies on an asset container with the handle assets, and it will fail (both on the front-end and in the control panel) if this asset container is not present. Although this can be adjusted in the configuration, it would be beneficial to mention this requirement in the documentation to assist non-developers in implementing a cookie-consent solution more smoothly.

geertjanknapen1 commented 1 month ago

Update, I was wrong, I cannot change the asset container utilized by the addon since I am unable to publish the config file itself. I am referring to the following line of code;

// /vendor/ddm-studio/cookie-byte/src/Configuration/ConfigBlueprint::getAssetsContainerHandle() 

$assetContainerHandle = config('cookie-byte.asset_container', 'assets');

So currently, the only way out is to create an asset container with the assets handle.

dryven-daniel commented 1 month ago

Hi @geertjanknapen1, you can use any asset container after changing the cookie byte config file, I added a documentation here: https://statamic.com/addons/dryven/cookie-byte/docs#advanced-configuration

Just publish the config file: php please vendor:publish --tag=cookie-byte-config

and change the asset_container property to your asset container's name. Let me know if you need anything else.