* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ declare(strict_types=1); namespace PrestaShop\Module\PsxDesign\Provider; if (!defined('_PS_VERSION_')) { exit; } use PrestaShop\Module\PsxDesign\DTO\ThemeImagesData; class ThemeImagesProvider { /** * @var string */ private $themesDir; public function __construct(string $themesDir) { $this->themesDir = $themesDir; } /** * Get active theme extra images for tablet and mobile provided by themes creators. * * @param string $themeName * * @return ThemeImagesData */ public function getCurrentThemeImages(string $themeName): ThemeImagesData { $mobileImage = null; $tabletImage = null; if (file_exists($this->themesDir . $themeName . '/preview-mobile.png')) { $mobileImage = 'themes/' . $themeName . '/preview-mobile.png'; } if (file_exists($this->themesDir . $themeName . '/preview-tablet.png')) { $tabletImage = 'themes/' . $themeName . '/preview-tablet.png'; } return new ThemeImagesData($mobileImage, $tabletImage); } }