From b85f74d4c86f6ea14e7baf698eb29b5c5d6b6f72 Mon Sep 17 00:00:00 2001 From: "John.R" Date: Wed, 25 Sep 2024 18:22:35 +0200 Subject: [PATCH 1/3] feat: add themes --- config/common/repository.yml | 6 - config/front/services.yml | 52 ++++--- ...hop_information.json => shop_details.json} | 2 +- ...hop_information.json => shop_details.json} | 2 +- ...hop_information.json => shop_details.json} | 2 +- ...hop_information.json => shop_details.json} | 2 +- e2e/src/helpers/shop-contents.ts | 3 +- src/Config/Config.php | 5 +- src/Repository/ThemeRepository.php | 91 ----------- ...tionService.php => ShopDetailsService.php} | 4 +- src/Service/ShopContent/ThemesService.php | 144 ++++++++++++++++++ 11 files changed, 183 insertions(+), 130 deletions(-) rename e2e/src/fixtures/1.6/{shop_information.json => shop_details.json} (95%) rename e2e/src/fixtures/1.7/{shop_information.json => shop_details.json} (95%) rename e2e/src/fixtures/8/{shop_information.json => shop_details.json} (95%) rename e2e/src/fixtures/9/{shop_information.json => shop_details.json} (95%) delete mode 100644 src/Repository/ThemeRepository.php rename src/Service/ShopContent/{ShopInformationService.php => ShopDetailsService.php} (97%) create mode 100644 src/Service/ShopContent/ThemesService.php diff --git a/config/common/repository.yml b/config/common/repository.yml index ace75cfb..fc339933 100644 --- a/config/common/repository.yml +++ b/config/common/repository.yml @@ -15,12 +15,6 @@ services: arguments: - '@=service("prestashop.adapter.legacy.context").getContext()' - PrestaShop\Module\PsEventbus\Repository\ThemeRepository: - class: PrestaShop\Module\PsEventbus\Repository\ThemeRepository - public: true - arguments: - - '@=service("prestashop.adapter.legacy.context").getContext()' - PrestaShop\Module\PsEventbus\Repository\GoogleTaxonomyRepository: class: PrestaShop\Module\PsEventbus\Repository\GoogleTaxonomyRepository public: true diff --git a/config/front/services.yml b/config/front/services.yml index 3920f603..44de1093 100644 --- a/config/front/services.yml +++ b/config/front/services.yml @@ -58,7 +58,7 @@ services: # SHOP CONTENT SERVICES PrestaShop\Module\PsEventbus\Service\ShopContent\OrdersService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrdersService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrdersService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\OrderRepository' @@ -66,62 +66,62 @@ services: - '@PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter' PrestaShop\Module\PsEventbus\Service\ShopContent\OrderCartRulesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderCartRulesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderCartRulesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\OrderCartRuleRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\OrderHistoriesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderHistoriesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderHistoriesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\OrderHistoryRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\OrderDetailsService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderDetailsService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\OrderDetailsService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\OrderDetailRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CarriersService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarriersService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarriersService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CarrierRepository' - '@PrestaShop\Module\PsEventbus\Repository\ConfigurationRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierDetailsService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierDetailsService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierDetailsService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CarrierRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierTaxesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierTaxesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CarrierTaxesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CarrierRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CartsService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartsService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartsService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CartRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CartProductsService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartProductsService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartProductsService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CartProductRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CartRulesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartRulesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CartRulesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CartRuleRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\ProductsService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductsService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductsService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ProductRepository' @@ -130,61 +130,61 @@ services: - '@PrestaShop\Module\PsEventbus\Formatter\ArrayFormatter' PrestaShop\Module\PsEventbus\Service\ShopContent\ProductBundlesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductBundlesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductBundlesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ProductBundleRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\ProductSuppliersService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductSuppliersService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductSuppliersService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ProductSupplierRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\ProductCarriersService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductCarriersService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ProductCarriersService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ProductCarrierRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CategoriesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CategoriesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CategoriesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CategoryRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CustomersService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CustomersService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CustomersService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CustomerRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\CurrenciesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\CurrenciesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\CurrenciesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\CurrencyRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\EmployeesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\EmployeesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\EmployeesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\EmployeeRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\ImagesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\ImagesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ImagesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ImageRepository' PrestaShop\Module\PsEventbus\Service\ShopContent\ImageTypesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\ImageTypesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ImageTypesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ImageTypeRepository' - PrestaShop\Module\PsEventbus\Service\ShopContent\ShopInformationService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\ShopInformationService + PrestaShop\Module\PsEventbus\Service\ShopContent\ShopDetailsService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ShopDetailsService public: true arguments: - '@=service("prestashop.adapter.legacy.context").getContext()' @@ -194,8 +194,14 @@ services: - '@PrestaShop\Module\PsEventbus\Service\ShopContent\CurrenciesService' PrestaShop\Module\PsEventbus\Service\ShopContent\ModulesService: - class: PrestaShop\Module\PsEventbus\Service\ShopContent\ModulesService + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ModulesService public: true arguments: - '@PrestaShop\Module\PsEventbus\Repository\NewRepository\ModuleRepository' - '@PrestaShop\Module\PsEventbus\Repository\ShopRepository' + + PrestaShop\Module\PsEventbus\Service\ShopContent\ThemesService: + class: PrestaShop\Module\PsEventbus\Service\ShopContent\ThemesService + public: true + arguments: + - '@=service("prestashop.adapter.legacy.context").getContext()' diff --git a/e2e/src/fixtures/1.6/shop_information.json b/e2e/src/fixtures/1.6/shop_details.json similarity index 95% rename from e2e/src/fixtures/1.6/shop_information.json rename to e2e/src/fixtures/1.6/shop_details.json index 53da0dcb..9cd1e3b6 100644 --- a/e2e/src/fixtures/1.6/shop_information.json +++ b/e2e/src/fixtures/1.6/shop_details.json @@ -1,7 +1,7 @@ [ { "id": "1", - "collection": "shop_informations", + "collection": "shop_details", "properties": { "created_at": "2024-07-16 15:33:52", "folder_created_at": "2024-07-16 15:34:17", diff --git a/e2e/src/fixtures/1.7/shop_information.json b/e2e/src/fixtures/1.7/shop_details.json similarity index 95% rename from e2e/src/fixtures/1.7/shop_information.json rename to e2e/src/fixtures/1.7/shop_details.json index f2c3ae9a..cd3a96b0 100644 --- a/e2e/src/fixtures/1.7/shop_information.json +++ b/e2e/src/fixtures/1.7/shop_details.json @@ -1,7 +1,7 @@ [ { "id": "1", - "collection": "shop_informations", + "collection": "shop_details", "properties": { "created_at": "2023-12-20 22:56:03", "folder_created_at": "2024-03-05 12:59:12", diff --git a/e2e/src/fixtures/8/shop_information.json b/e2e/src/fixtures/8/shop_details.json similarity index 95% rename from e2e/src/fixtures/8/shop_information.json rename to e2e/src/fixtures/8/shop_details.json index e09b49ca..ad085f79 100644 --- a/e2e/src/fixtures/8/shop_information.json +++ b/e2e/src/fixtures/8/shop_details.json @@ -1,7 +1,7 @@ [ { "id": "1", - "collection": "shop_informations", + "collection": "shop_details", "properties": { "created_at": "2024-08-22T12:27:09+0200", "folder_created_at": "2024-08-27T10:07:19+0200", diff --git a/e2e/src/fixtures/9/shop_information.json b/e2e/src/fixtures/9/shop_details.json similarity index 95% rename from e2e/src/fixtures/9/shop_information.json rename to e2e/src/fixtures/9/shop_details.json index fb978956..57254296 100644 --- a/e2e/src/fixtures/9/shop_information.json +++ b/e2e/src/fixtures/9/shop_details.json @@ -1,7 +1,7 @@ [ { "id": "1", - "collection": "shop_informations", + "collection": "shop_details", "properties": { "created_at": "2024-06-10 02:27:21", "folder_created_at": "2024-06-10 18:01:29", diff --git a/e2e/src/helpers/shop-contents.ts b/e2e/src/helpers/shop-contents.ts index aa52f374..5874848f 100644 --- a/e2e/src/helpers/shop-contents.ts +++ b/e2e/src/helpers/shop-contents.ts @@ -38,8 +38,9 @@ export const shopContentMapping = { employees: "employees", images: "images", image_types: "image-types", - shop_informations: "shops-informations", + shop_details: "shop-details", modules: "modules", + themes: "themes" } as const; type ShopContentMapping = typeof shopContentMapping; diff --git a/src/Config/Config.php b/src/Config/Config.php index 3617a880..f4c7f5db 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -46,7 +46,6 @@ class Config const COLLECTION_HEALTHCHECK = 'healthcheck'; const COLLECTION_IMAGES = 'images'; const COLLECTION_IMAGE_TYPES = 'image_types'; - const COLLECTION_INFO = 'info'; const COLLECTION_LANGUAGES = 'languages'; const COLLECTION_MANUFACTURERS = 'manufacturers'; const COLLECTION_MODULES = 'modules'; @@ -59,7 +58,7 @@ class Config const COLLECTION_PRODUCT_BUNDLES = 'product_bundles'; const COLLECTION_PRODUCT_CARRIERS = 'product_carriers'; const COLLECTION_PRODUCT_SUPPLIERS = 'product_suppliers'; - const COLLECTION_SHOP_INFORMATIONS = 'shop_informations'; + const COLLECTION_SHOP_DETAILS = 'shop_details'; const COLLECTION_SPECIFIC_PRICES = 'specific_prices'; const COLLECTION_STOCKS = 'stocks'; const COLLECTION_STOCK_MVTS = 'stock_movements'; @@ -97,7 +96,7 @@ class Config self::COLLECTION_PRODUCT_BUNDLES, self::COLLECTION_PRODUCT_CARRIERS, self::COLLECTION_PRODUCT_SUPPLIERS, - self::COLLECTION_SHOP_INFORMATIONS, + self::COLLECTION_SHOP_DETAILS, self::COLLECTION_SPECIFIC_PRICES, self::COLLECTION_STOCKS, self::COLLECTION_STOCK_MVTS, diff --git a/src/Repository/ThemeRepository.php b/src/Repository/ThemeRepository.php deleted file mode 100644 index d773ee3e..00000000 --- a/src/Repository/ThemeRepository.php +++ /dev/null @@ -1,91 +0,0 @@ -context = $context; - $this->db = \Db::getInstance(); - } - - /** - * @return array|mixed|null - */ - public function getThemes() - { - if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>')) { - if ($this->context->shop === null) { - throw new \PrestaShopException('No shop context'); - } - - $themeRepository = (new ThemeManagerBuilder($this->context, $this->db)) - ->buildRepository($this->context->shop); - - $currentTheme = $this->context->shop->theme; - $themes = $themeRepository->getList(); - - return array_map(function ($key, $theme) use ($currentTheme) { - return [ - 'id' => md5((string) $key), - 'collection' => Config::COLLECTION_THEMES, - 'properties' => [ - 'theme_id' => md5((string) $key), - 'name' => (string) $theme->getName(), - 'theme_version' => (string) $theme->get('version'), - 'active' => $theme->getName() == $currentTheme->getName(), - ], - ]; - }, array_keys($themes), $themes); - } else { - /* @phpstan-ignore-next-line */ - $themes = \Theme::getAvailable(false); - - return array_map(function ($theme) { - /* @phpstan-ignore-next-line */ - $themeObj = \Theme::getByDirectory($theme); - - $themeData = [ - 'id' => md5($theme), - 'collection' => Config::COLLECTION_THEMES, - 'properties' => [], - ]; - - /* @phpstan-ignore-next-line */ - if ($themeObj instanceof \Theme) { - /* @phpstan-ignore-next-line */ - $themeInfo = \Theme::getThemeInfo($themeObj->id); - - $themeData['properties'] = [ - 'theme_id' => md5($theme), - 'name' => isset($themeInfo['theme_name']) ? $themeInfo['theme_name'] : '', - 'theme_version' => isset($themeInfo['theme_version']) ? $themeInfo['theme_version'] : '', - 'active' => isset($themeInfo['theme_version']) ? false : (string) $this->context->theme->id == (string) $themeInfo['theme_id'], - ]; - } else { - $themeData['properties'] = [ - 'theme_id' => md5($theme), - 'name' => $theme, - 'theme_version' => '', - 'active' => false, - ]; - } - - return $themeData; - }, $themes); - } - } -} diff --git a/src/Service/ShopContent/ShopInformationService.php b/src/Service/ShopContent/ShopDetailsService.php similarity index 97% rename from src/Service/ShopContent/ShopInformationService.php rename to src/Service/ShopContent/ShopDetailsService.php index 9f28b7a1..6cfa8d09 100644 --- a/src/Service/ShopContent/ShopInformationService.php +++ b/src/Service/ShopContent/ShopDetailsService.php @@ -7,7 +7,7 @@ use PrestaShop\Module\PsEventbus\Repository\LanguageRepository; use PrestaShop\Module\PsEventbus\Repository\ShopRepository; -class ShopInformationService implements ShopContentServiceInterface +class ShopDetailsService implements ShopContentServiceInterface { /** @var CurrenciesService */ private $currenciesService; @@ -75,7 +75,7 @@ public function getContentsForFull($offset, $limit, $langIso, $debug) return [ [ 'id' => '1', - 'collection' => Config::COLLECTION_SHOP_INFORMATION, + 'collection' => Config::COLLECTION_SHOP_DETAILS, 'properties' => [ 'created_at' => $this->shopRepository->getCreatedAt(), 'folder_created_at' => $folderCreatedAt, diff --git a/src/Service/ShopContent/ThemesService.php b/src/Service/ShopContent/ThemesService.php new file mode 100644 index 00000000..c4447a3f --- /dev/null +++ b/src/Service/ShopContent/ThemesService.php @@ -0,0 +1,144 @@ +context = $context; + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * @param bool $debug + * + * @return array + */ + public function getContentsForFull($offset, $limit, $langIso, $debug) + { + $result = $this->getAllThemes(); + + if (empty($result)) { + return []; + } + + $themes = $this->formatThemes($result); + + return array_map(function ($item) { + return [ + 'id' => $item['theme_id'], + 'collection' => Config::COLLECTION_THEMES, + 'properties' => $item, + ]; + }, $themes); + } + + /** + * @param int $limit + * @param array $contentIds + * @param string $langIso + * @param bool $debug + * + * @return array + */ + public function getContentsForIncremental($limit, $contentIds, $langIso, $debug) + { + $result = $this->getAllThemes(); + + if (empty($result)) { + return []; + } + + $themes = $this->formatThemes($result); + + return array_map(function ($item) { + return [ + 'id' => $item['theme_id'], + 'collection' => Config::COLLECTION_THEMES, + 'properties' => $item, + ]; + }, $themes); + } + + /** + * @param int $offset + * @param int $limit + * @param string $langIso + * + * @return int + */ + public function getFullSyncContentLeft($offset, $limit, $langIso) + { + return 0; + } + + private function getAllThemes() + { + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>')) { + if ($this->context->shop === null) { + throw new \PrestaShopException('No shop context'); + } + + $themeRepository = (new ThemeManagerBuilder($this->context, \Db::getInstance()))->buildRepository($this->context->shop); + return $themeRepository->getList(); + } else { + /* @phpstan-ignore-next-line */ + return \Theme::getAvailable(false); + } + } + + private function formatThemes($themes) + { + if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>')) { + if ($this->context->shop === null) { + throw new \PrestaShopException('No shop context'); + } + + $currentTheme = $this->context->shop->theme; + + return array_map(function ($key, $theme) use ($currentTheme) { + return [ + 'theme_id' => md5((string) $key), + 'name' => (string) $theme->getName(), + 'theme_version' => (string) $theme->get('version'), + 'active' => $theme->getName() == $currentTheme->getName(), + ]; + }, array_keys($themes), $themes); + } else { + return array_map(function ($theme) { + /* @phpstan-ignore-next-line */ + $themeObj = \Theme::getByDirectory($theme); + + /* @phpstan-ignore-next-line */ + if ($themeObj instanceof \Theme) { + /* @phpstan-ignore-next-line */ + $themeInfo = \Theme::getThemeInfo($themeObj->id); + + return [ + 'theme_id' => md5($theme), + 'name' => isset($themeInfo['theme_name']) ? $themeInfo['theme_name'] : '', + 'theme_version' => isset($themeInfo['theme_version']) ? $themeInfo['theme_version'] : '', + 'active' => isset($themeInfo['theme_version']) ? false : (string) $this->context->theme->id == (string) $themeInfo['theme_id'], + ]; + } else { + return [ + 'theme_id' => md5($theme), + 'name' => $theme, + 'theme_version' => '', + 'active' => false, + ]; + } + }, $themes); + } + } +} From 317923635b03236dec0ae1ec90aa41159f3355fd Mon Sep 17 00:00:00 2001 From: "John.R" Date: Wed, 25 Sep 2024 18:26:19 +0200 Subject: [PATCH 2/3] fix: phpcs-fixer and phpstan --- src/Service/ShopContent/ThemesService.php | 24 ++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/Service/ShopContent/ThemesService.php b/src/Service/ShopContent/ThemesService.php index c4447a3f..3ec42ee8 100644 --- a/src/Service/ShopContent/ThemesService.php +++ b/src/Service/ShopContent/ThemesService.php @@ -2,7 +2,6 @@ namespace PrestaShop\Module\PsEventbus\Service\ShopContent; -use Exception; use PrestaShop\Module\PsEventbus\Config\Config; use PrestaShop\PrestaShop\Core\Addon\Theme\ThemeManagerBuilder; @@ -82,7 +81,14 @@ public function getFullSyncContentLeft($offset, $limit, $langIso) return 0; } - private function getAllThemes() + /** + * Get all Themes + * + * @return mixed + * + * @throws \PrestaShopException + */ + private function getAllThemes() { if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>')) { if ($this->context->shop === null) { @@ -90,6 +96,7 @@ private function getAllThemes() } $themeRepository = (new ThemeManagerBuilder($this->context, \Db::getInstance()))->buildRepository($this->context->shop); + return $themeRepository->getList(); } else { /* @phpstan-ignore-next-line */ @@ -97,6 +104,13 @@ private function getAllThemes() } } + /** + * @param array $themes + * + * @return array + * + * @throws \PrestaShopException + */ private function formatThemes($themes) { if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '1.7', '>')) { @@ -105,7 +119,7 @@ private function formatThemes($themes) } $currentTheme = $this->context->shop->theme; - + return array_map(function ($key, $theme) use ($currentTheme) { return [ 'theme_id' => md5((string) $key), @@ -118,12 +132,12 @@ private function formatThemes($themes) return array_map(function ($theme) { /* @phpstan-ignore-next-line */ $themeObj = \Theme::getByDirectory($theme); - + /* @phpstan-ignore-next-line */ if ($themeObj instanceof \Theme) { /* @phpstan-ignore-next-line */ $themeInfo = \Theme::getThemeInfo($themeObj->id); - + return [ 'theme_id' => md5($theme), 'name' => isset($themeInfo['theme_name']) ? $themeInfo['theme_name'] : '', From e4743811b78705ff3e8e209a7fabe50d6fc1855e Mon Sep 17 00:00:00 2001 From: "John.R" Date: Thu, 26 Sep 2024 11:02:41 +0200 Subject: [PATCH 3/3] fix: lint js --- e2e/src/helpers/shop-contents.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/src/helpers/shop-contents.ts b/e2e/src/helpers/shop-contents.ts index 5874848f..38900a4f 100644 --- a/e2e/src/helpers/shop-contents.ts +++ b/e2e/src/helpers/shop-contents.ts @@ -40,7 +40,7 @@ export const shopContentMapping = { image_types: "image-types", shop_details: "shop-details", modules: "modules", - themes: "themes" + themes: "themes", } as const; type ShopContentMapping = typeof shopContentMapping;