This documentation always describes the latest published version.
| Property | Value |
|---|---|
| Composer package | mmd/smart-maps-integration |
| Plugin class | Mmd\SmartMapsIntegration\MmdSmartMapsIntegration |
Plugin name for bin/console |
MmdSmartMapsIntegration |
| Namespace | Mmd\SmartMapsIntegration |
| Requirements | PHP >= 8.2, shopware/core ~6.7.0 |
| Configuration keys | MmdSmartMapsIntegration.config.apiKey, .enabled, .countryFilter |
| File | Purpose |
|---|---|
src/MmdSmartMapsIntegration.php |
Plugin class, no logic of its own |
src/Subscriber/StorefrontSubscriber.php |
Listens to StorefrontRenderEvent, filters by route and sets the Twig parameters |
src/Service/SmartMapsConfigService.php |
Reads the settings per sales channel from the system configuration |
src/Struct/SmartMapsConfig.php |
Value object with the isConfigured() check |
src/Resources/config/config.xml |
Admin configuration |
src/Resources/views/storefront/base.html.twig |
Loads CSS and JS from SmartMaps and contains the initialisation script |
src/Resources/views/storefront/component/address/address-form.html.twig |
Wraps the address form with the data attributes |
src/Resources/app/storefront/src/main.js |
Registers the JS class SmartMapsAutocomplete on the selector [data-smartmaps-autocomplete] |
| Parameter | Content |
|---|---|
mmdSmartMapsConfig |
enabled (bool) and countryFilter (string) |
mmdSmartMapsApiKey |
the trimmed API key |
Both are only set when the route is in the list and the configuration is valid.
There are two paths that bind the autocomplete to a street field: the inline script in base.html.twig and the registered JS class SmartMapsAutocomplete. Before initialising, the inline script checks the attribute dataset.smartmapsInitialized on the street field and skips fields that are already initialised, the JS class has no such check.
The subscriber catches every exception and ignores it, so a plugin error never disturbs the storefront. Errors in the browser end up in the console, from the inline script with the prefix [SmartMaps] and from the JS class with the prefix [SmartMapsAutocomplete].
config.xml)