How hyva-themes/magento2-theme-module works
Hyvä’s Magento theme module supplies shared storefront infrastructure rather than a complete theme. Its runtime spans theme detection and layout integration, template-facing view models, asset and interaction helpers, and cache/dependency handling; it also provides sample-data commands. The README describes the module’s role but not detailed runtime wiring, so the graph uses only relationships shown in sampled source or SOURCE INDEX references; unsampled capabilities are represented without inferred call edges.
Main entry points: RegisterPageJsDependencies.php JS dependency observer · CurrentTheme.php Current theme · SampleDataCommandList.php Sample-data commands · HyvaThemes.php Hyvä themes
Components 25
Theme integration
- Current theme
src/Service/CurrentTheme.php - Hyvä themes
src/Service/HyvaThemes.php - DI theme reader
src/Service/HyvaBaseThemesDiXmlReader.php - Layout handles
src/Observer/AddLayoutHandles.php - Catalog breadcrumbs
src/Block/Catalog/Breadcrumbs.php
Storefront APIs
- Store view model
src/ViewModel/Store.php - Customer reviews
src/ViewModel/Customer/ReviewList.php - Product page APIs
src/ViewModel/ProductPage.php - Cart APIs
src/ViewModel/Cart/Items.php
Assets and UI
- Media view model
src/ViewModel/Media.php - Media HTML provider
src/Model/Media/MediaHtmlProvider.php - Modal view model
src/ViewModel/Modal.php - Modal builder
src/Model/Modal/ModalBuilder.php - SVG icons
src/ViewModel/SvgIcons.php - Lucide icons
src/ViewModel/LucideIcons.php - Alpine runtime
src/view/base/web/js/alpine3.js
Rendering runtime
- JS dependency observer
src/Observer/RegisterPageJsDependencies.php - Page JS registry
src/Model/PageJsDependencyRegistry.php - Block JS dependencies
src/ViewModel/BlockJsDependencies.php - Block cache view model
src/ViewModel/BlockCache.php - HTML cache-tag storage
src/Model/HtmlBlockCacheTagsStorage.php
Admin and commands
- Sample-data commands
src/Console/SampleDataCommandList.php - Sample-data deploy
src/Console/Command/SampleData/DeployCommand.php - Sample-data remove
src/Console/Command/SampleData/RemoveCommand.php
Other components
- Magento storefront
Connections 15
- Magento storefront → Layout handles: dispatches event
- Layout handles → Current theme: checks theme
src/Observer/AddLayoutHandles.php - Current theme → Hyvä themes: checks theme
src/Service/CurrentTheme.php - Hyvä themes → DI theme reader: reads fallback
src/Service/HyvaThemes.php - Media view model → Media HTML provider: uses provider
src/ViewModel/Media.php - Media HTML provider → Store view model: uses store data
src/Model/Media/MediaHtmlProvider.php - Modal view model → Modal builder: uses builder
src/Model/Modal/ModalBuilder.php - Lucide icons → SVG icons: extends icons
src/ViewModel/LucideIcons.php - JS dependency observer → Current theme: checks theme
src/Observer/RegisterPageJsDependencies.php - JS dependency observer → Page JS registry: registers dependencies
src/Observer/RegisterPageJsDependencies.php - JS dependency observer → Block JS dependencies: collects dependencies
src/Observer/RegisterPageJsDependencies.php - JS dependency observer → Block cache view model: reads cache tags
src/Observer/RegisterPageJsDependencies.php - Block cache view model → HTML cache-tag storage: stores cache tags
src/Model/HtmlBlockCacheTagsStorage.php - Sample-data commands → Sample-data deploy: registers command
src/Console/SampleDataCommandList.php - Sample-data commands → Sample-data remove: registers command
src/Console/SampleDataCommandList.php