hyva-themes / magento2-compat-module-fallback

hyva-themes/magento2-compat-module-fallback

  • Hyvä Themes B.V.
magento2-module Compatibility: Not compatible Code Quality: Fail Tests: N/A Security: Pass OSL-3.0

Hyvä Themes - Compatibility Module View Fallback

Hyvä Themes

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

  1. <theme_dir>/<module_name>/templates
  2. <module_dir>/view/<area>/templates
  3. <module_dir>/view/base/templates

Fallback with one compatibility module for Orig_Module

  1. <theme_dir>/<module_name>/templates
  2. <compat_module_dir>/view/<area>/templates/Orig_Module
  3. <compat_module_dir>/view/<area>/templates
  4. <module_dir>/view/<area>/templates
  5. <compat_module_dir>/view/base/templates/Orig_Module
  6. <compat_module_dir>/view/base/templates
  7. <module_dir>/view/base/templates

Example:

  • Original files:
    • Orig_Module::cookie_bar.phtml
    • Other_Module::cookie_bar.phtml
  • Overrides:
    • Hyva_OrigModule::Orig_Module/cookie_bar.phtml
    • Hyva_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.
Versions
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.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Fail dependency conflict Fail dependency conflict
2.4.8 Fail dependency conflict not tested
2.4.9 not tested not tested

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.

Static analysis results
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.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Error Error
2.4.8 Error Error
2.4.9 Error Error

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

Unit tests results by Magento and PHP version
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

Integration tests results by Magento and PHP version
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.

Security results
Tool Status Findings Summary
Composer audit N/A 0 no resolvable dependency tree to audit — Your requirements could not be resolved to an installable set of packages. Problem 1
Malware scan Pass 0
License
OSL-3.0
Authors

More from hyva-themes

View vendor
Make it pay

Turn 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.