This documentation always describes the latest published version.
The subscriber listens to the StorefrontRenderEvent and provides the template with the parameters mmdKlaroActive, mmdKlaroConfig, mmdKlaroPrimaryColor, mmdKlaroSecondaryColor, mmdKlaroDeclineColor, mmdKlaroGoogleConsentMode, mmdKlaroGoogleConsentModeWaitForUpdate and mmdKlaroShowFooterLink. The KlaroConfigService reads all settings with the ID of the current sales channel, and only services assigned to that sales channel make it into the configuration.
All texts end up in Klaro's fallback key zz. As a result, Klaro always shows the language of the shop and not the language of the browser.
Selection values (category, position, theme, storage method) and free text values (storage name, privacy URL, technical name) are checked against allowlists or character patterns before output.
src/
βββ MmdKlaroCookieConsent.php Plugin class (uninstall cleans up tables and configuration)
βββ Core/
β βββ Content/CookieService/ Entity, definition and collection of the cookie services
β β βββ Aggregate/ Translation and sales channel assignment
β βββ Klaro/ KlaroConfigService and KlaroConfigServiceInterface, builds the Klaro configuration
βββ Storefront/Subscriber/ StorefrontRenderSubscriber
βββ Migration/ Database migrations
βββ Resources/
βββ app/administration/ Admin module mmd-klaro-service
βββ config/ config.xml, services.xml
βββ public/administration/ Precompiled admin assets
βββ public/storefront/vendor/klaro/ klaro.js and klaro.css
βββ snippet/ Storefront snippets (de_DE, en_GB)
βββ views/storefront/ Template overrides
| Table | Content |
|---|---|
mmd_klaro_cookie_service |
Cookie services with technical name, category, flags, cookie rules and position |
mmd_klaro_cookie_service_translation |
Title and description per language |
mmd_klaro_cookie_service_sales_channel |
Assignment of services to sales channels |
The plugin ships four migrations: creating the tables, creating the default service session, removing a former callback field, and removing obsolete configuration fields for category texts (replaced by snippets).
The plugin extends three storefront templates via sw_extends. Another plugin or theme can extend these blocks as well:
| Template | Overridden block | Purpose |
|---|---|---|
storefront/base.html.twig |
base_cookie_permission |
Suppresses the native Shopware cookie notice when Klaro is active |
storefront/base.html.twig |
base_body_script |
Outputs the Klaro configuration, the Google Consent Mode code, the anchor handler and the Klaro script |
storefront/layout/footer/footer.html.twig |
layout_footer_service_menu_content |
Appends the "Cookie Settings" footer link |
storefront/layout/meta.html.twig |
layout_head_stylesheet |
Includes klaro.css and the color variables |
| Namespace | Usage |
|---|---|
mmd-klaro |
Storefront: dialog texts and category texts |
mmd-klaro-service |
Administration: labels of the admin module |
The plugin dispatches no events of its own, registers no routes and no console commands. It only subscribes to the StorefrontRenderEvent.