cloudinary_magento2 icon indicating copy to clipboard operation
cloudinary_magento2 copied to clipboard

Refactor: Use DesignInterface for Hyvä Theme Detection in ProductGalleryHelper

Open itaymesh opened this issue 10 months ago • 0 comments

Description:

Overview

This PR updates the ProductGalleryHelper::isHyvaThemeEnabled() method to use DesignInterface instead of ThemeProvider, ensuring accurate detection of Hyvä-based themes, including child themes.

Changes:

  • Replaced ThemeProvider with DesignInterface to align with \Hyva\Theme\Service\CurrentTheme::isHyva().
  • Updated isHyvaThemeEnabled() to check parent themes recursively for better Hyvä theme detection.
  • Injected DesignInterface via constructor to follow Magento's best practices.

Why This Change?

  • Ensures compatibility with Hyvä child themes.
  • Matches Hyvä’s official approach to theme detection.
  • Reduces direct reliance on ThemeProvider and ScopeConfigInterface for theme resolution.

Notes:

  • This change does not affect existing functionality beyond improving Hyvä theme detection.

  • No other parts of the class were refactored to maintain scope.

itaymesh avatar Mar 16 '25 06:03 itaymesh