hyva-themes / magento2-compat-module-fallback
hyva-themes/magento2-compat-module-fallback
Hyvä Themes - Compatibility Module View Fallback
hyva-themes/magento2-compat-module-fallback
Installation
This module is usually installed automatically by composer as a dependency of Hyvä Themes compatibility modules.
If you nevertheless want to install it manually (for example if you would like to contribute), run
composer config repositories.hyva-themes/magento2-compat-module-fallback git [email protected]:hyva-themes/magento2-compat-module-fallback.git
composer require hyva-themes/magento2-compat-module-fallback
Purpose
This module allows registering Hyvä compatibility modules for automatic view file overrides.
The purpose of this is to avoid boilerplate layout XML and di.xml plugins, when block content is added in a result
programmatically by a module.
Once a module is registered as a Hyvä compatibility module, templates of the original module can be overridden by
placing the .phtml file in the same location in the compatibility module.
For example:
Template location in the original module: Orig_Module::page/example.phtml
Template location in the compatibility module: Hyva_OrigModule::page/example.phtml
In addition to the automatic tempalte overrides, modules registered with the compat module registry will also be
added to the app/etc/hyva-themes.json file, and can hook into the tailwind styles.css build process.
Usage
Compatibility modules are registered with the CompatModuleRegistry using frontend/di.xml.
Since modules can have more than one compatibility module, and compatibility modules can
have more than one original module, the constructor argument map can not be a simple associative array.
The argument array structure looks like this:
<type name="Hyva\CompatModuleFallback\Model\CompatModuleRegistry">
<arguments>
<argument name="compatModules" xsi:type="array">
<item name="hyva_origmodule_map" xsi:type="array">
<item name="original_module" xsi:type="string">Orig_Module</item>
<item name="compat_module" xsi:type="string">Hyva_OrigModule</item>
</item>
<item name="hyva_othermodule_map" xsi:type="array">
<item name="original_module" xsi:type="string">Other_Module</item>
<item name="compat_module" xsi:type="string">Hyva_OtherModule</item>
</item>
</argument>
</arguments>
</type>
The above example registers the module Hyva_OrigModule as a compatibility module for both Orig_Module and Other_Module.
Note: The keys of the first level of the array do not matter, as long as they are unique.
Details
The first example in the Purpose section above glossed over some details. The fallback actually contains two additional
folders for each compatibility module.
This is useful when:
- The compatibility module handles more than one original module.
- Both original modules have a template file with the same name.
The following lists of fallback modules hopefully make it clear:
Original fallback
<theme_dir>/<module_name>/templates<module_dir>/view/<area>/templates<module_dir>/view/base/templates
Fallback with one compatibility module for Orig_Module
<theme_dir>/<module_name>/templates<compat_module_dir>/view/<area>/templates/Orig_Module<compat_module_dir>/view/<area>/templates<module_dir>/view/<area>/templates<compat_module_dir>/view/base/templates/Orig_Module<compat_module_dir>/view/base/templates<module_dir>/view/base/templates
Example:
- Original files:
Orig_Module::cookie_bar.phtmlOther_Module::cookie_bar.phtml
- Overrides:
Hyva_OrigModule::Orig_Module/cookie_bar.phtmlHyva_OrigModule::Other_Module/cookie_bar.phtml
License
Copyright © 2020-present Hyvä Themes.
Each source file included in this distribution is licensed under OSL 3.0.
http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
Please see LICENSE.txt for the full text of the OSL 3.0 license.
Changelog
Please see The Changelog.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
Unreleased
Added
- Nothing yet.
Changed
- Nothing.
Removed
- No removals.
1.1.4 - 2025-11-10
Added
- Nothing added
Changed
- Changed license to OSL 3.0.
Removed
- Nothing removed
1.1.3 - 2023-12-08
Added
- Add Exclusion Mechanism for Module Tailwind Config.
Changed
- Nothing added
Removed
- Nothing removed
1.1.2 - 2022-02-21
Added
-
Add compat modules to the app/etc/hyva-themes.json configuration file.
This requires compat modules to be registered with \Hyva\CompatModuleFallback\Model\CompatModuleRegistry in
the etc/frontend/di.xml file.
Changed
- Nothing.
Removed
- No removals.
1.1.1 - 2022-02-21
Added
-
Added methods getCompatModules and getOrigModules
This will allow generating a console command to dump a list to all compat modules, which in turn then can be used
to automatically add them to the purge list for tailwind css.
Changed
- Nothing.
Removed
- No removals.
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 1.1.4 | stable | Fail | Not compatible Details | 2025-11-04 15:42:50 |
| 1.1.3 | stable | Not tested | Not yet tested Details | 2023-12-08 09:30:37 |
| 1.1.2 | stable | Not tested | Not yet tested Details | 2022-03-10 14:48:05 |
| 1.1.1 | stable | Not tested | Not yet tested Details | 2022-02-21 15:42:06 |
| 1.1.0 | stable | Not tested | Not yet tested Details | 2021-04-29 13:08:43 |
| 1.0.0 | stable | Not tested | Not yet tested Details | 2021-04-29 08:45:36 |
Requires 2
| Package | Constraint |
|---|---|
| magento/framework | * |
| hyva-themes/magento2-theme-module | * |
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 8 | 8 warnings (ruleset: Magento2) — 2 auto-fixable with phpcbf |
| PHPMD | Warning | 2 | 2 rule violations (IfStatementAssignment:1, UnusedFormalParameter:1) |
| Cpd | Pass | 0 | |
| Composer validate | Info | 2 | valid; 2 advisory notes (composer validate --strict) |
PHPStan
Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Integration tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
More from hyva-themes
View vendorTurn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.
