Open wdebusschere opened 3 months ago
I'm not sure if this is the same issue but I'm having trouble hiding categories. I only want to show necessary and marketing but when adding this to my config file:
'measurement' => ['enabled' => false, 'readOnly' => false ],
'functionality' => ['enabled' => false, 'readOnly' => false ],
'experience' => ['enabled' => false, 'readOnly' => false ],
Nothing changes on the website.
Same issue
To disable a category, you need to override the language files, as these are essentially the ones that define the categories. The categories
section in the config is only for the defaults (enabled
means the category is enabled by default).
It's not intuitive this way, but I'm basically just mirroring the functionality of the JS plugin. They mention that the translations are used to generate the modal content here: https://cookieconsent.orestbida.com/advanced/language-configuration.html#language-config.
I have updated the readme to more prominently mention how to disable a category.
Why not sync the categories with the translations? Their playground works that way. Basically, the translations are updated/included according to the selected categories.
I can make a pull request if you want.
For example, if a category is set to false
, the respective translation section is not included:
// config.php
return [
'zephir.cookieconsent' => [
'categories' => [
'necessary' => [
'enabled' => true,
'readOnly' => true
],
'measurement' => [],
'functionality' => false, // do not show category
'experience' => false, // do not show category
'marketing' => false // do not show category
]
]
];
@andrepimpao That sounds like a good idea! I basically took the functionality of the JS plugin and "mapped" it as best I could into a Kirby plugin. But it would be more intuitive if a category set to false was automatically excluded. A PR would be very welcome 🙂
Done #7.
It is possible to override the categories in the config.php, but its not possible to remove 1 of the 5 categories for example.
Example We only use functionality, the rest we dont need and we dont want to show.
This line will need to be tuned:
'categories' => kirby()->option('zephir.cookieconsent.categories'),