hyva-themes / magento2-base-layout-reset
hyva-themes/magento2-base-layout-reset
Hyva Themes Magento base layout reset generation
Hyvä Themes - Base Layout Reset Module
hyva-themes/magento2-base-layout-reset
Generates a version of the base layout XML of core Magento modules and bundled extensions without block declarations.
This generated base layout is used instead of the original base layout for Hyvä based themes.
Its purpose is to avoid loading the original base layout, only to reset it with the reset theme. This improves performance on page requests that hit a cold layout cache.
Installation
composer require hyva-themes/magento2-base-layout-reset
bin/magento module:enable Hyva_BaseLayoutReset
bin/magento setup:upgrade
If your custom theme inherits from Hyva/default or Hyva/default-csp, no additional steps are required.
Usage
In Hyvä default-theme versions up to 1.3.18, a parent theme was used to override and remove block layout declarations from module folders.
Starting with version 1.4.0, Hyvä Themes use this module instead, which dynamically generates base layout declarations in var/hyva-layout-resets/.
This approach improves:
- Performance, on page requests with a cold layout cache.
- Maintainability, by removing the need for a reset theme.
The base layout resets are generated on the fly.
It is also possible to trigger generation by running the command
bin/magento hyva:base-layout-resets:generate
Configuring the generation folder
You can define a custom absolute path for the generated layout files in app/etc/env.php using the hyva_layout_resets_generation_directory key.
Example
return [
'hyva_layout_resets_generation_directory' => '/var/www/html/generated/code/hyva-layout-resets/',
...
What determines if a theme is a Hyvä Theme
A theme is considered a Hyvä-based theme if its inheritance chain contains a theme with a name starting with Hyva/.
This was always true when using the Hyva/reset theme. However, when using the generated base layouts instead, this detection no longer works.
To ensure proper detection, base Hyvä themes must be added to the constructor argument $hyvaBaseThemes of Hyva\BaseLayoutReset\Service\HyvaThemes via di.xml.
In most projects, this is best done within a custom module, but it can also be defined in app/etc/di.xml.
Custom Hyvä base themes
If you maintain a custom Hyvä base theme that directly extends Hyva/reset, you can migrate it to use the generated base layout reset.
NOTE: This migration is optional - existing themes can continue using the reset theme without issues.
Migration Steps
- Add
<update handle="default_hyva"/>toMagento_Theme/layout/default.xml. - Copy
Magento_Theme/templates/root.phtmlfrom the reset theme into the Hyvä theme. - Remove
<parent>Hyva/reset</parent>fromtheme.xml. - Update the
themetable in the database, setting theparent_idof your theme toNULL. - Add your theme code to the
hyvaBaseThemesarray in the constructor argument forHyva\BaseLayoutReset\Service\HyvaThemeswithindi.xml. - Clear the cache.
This module provides commands to help with these steps.
List Hyvä Theme reset information
To list all Hyvä themes and see their migration status, run:
bin/magento hyva:base-layout-resets:info
Migrating a custom Hyvä base theme to the generated layout reset
To automatically migrate a Hyvä base theme to the generated layout reset, run:
bin/magento hyva:base-layout-resets:migrate Vendor/theme
Replace Vendor/theme with your theme code.
NOTE: This command will update app/etc/di.xml, adding your theme to the hyvaBaseThemes argument of
Hyva\BaseLayoutReset\Service\HyvaThemes.
If you prefer not to modify app/etc/di.xml, you can move this declaration into a di.xml file inside your custom module.
Be aware that many projects do not keep app/etc/di.xml in version control, and any changes may be lost. We recommend adding the declaration to a custom module di.xml instead.
License
This package is licensed under the Open Software License (OSL 3.0).
- Copyright: Copyright © 2020-present Hyvä Themes. All rights reserved.
- License Text: The full text of the OSL 3.0 license can be found in the
LICENSE.txtfile within this package, and is also available online at http://opensource.org/licenses/osl-3.0.php.
No changelog yet
The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.
| Version | Stability | QA Status | Compatibility | Released |
|---|---|---|---|---|
| 2.0.5 | stable | Pass | Not yet tested Details | 2026-06-08 14:59:52 |
| 2.0.4 | stable | Not tested | Not yet tested Details | 2026-04-09 17:06:12 |
| 2.0.3 | stable | Not tested | Not yet tested Details | 2026-01-06 10:26:31 |
| 2.0.2 | stable | Not tested | Not yet tested Details | 2025-11-24 11:08:20 |
| 2.0.1 | stable | Not tested | Not yet tested Details | 2025-11-09 20:24:34 |
| 2.0.0 | stable | Not tested | Not yet tested Details | 2025-11-03 13:27:54 |
| 1.0.0 | stable | Not tested | Not yet tested Details | 2025-10-17 17:52:58 |
Requires 8
| Package | Constraint |
|---|---|
| ext-dom | * |
| ext-libxml | * |
| ext-simplexml | * |
| hyva-themes/magento2-theme-module | >1.3.17 |
| magento/framework | * |
| magento/module-theme | >=1.0.2 |
| php | >=7.4.0 |
| psr/log | ^1 || ^2 || ^3 |
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.
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | not tested | not tested | ||
| 2.4.8 | not tested | 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.
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.
