From c7f43ad02c699ffc4a09e64cc6d6b9260cce6d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Thu, 8 Oct 2026 17:22:07 +0200 Subject: [PATCH] feat: add a feature flag for the pickups table on product detail pages --- .../Classes/Service/PickupOverviewService.php | 17 +++++++++++++++-- .../ext/ep_products/ext_conf_template.txt | 3 +++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Service/PickupOverviewService.php b/public/typo3conf/ext/ep_products/Classes/Service/PickupOverviewService.php index f05d0070..bb5ecf2e 100644 --- a/public/typo3conf/ext/ep_products/Classes/Service/PickupOverviewService.php +++ b/public/typo3conf/ext/ep_products/Classes/Service/PickupOverviewService.php @@ -5,6 +5,7 @@ namespace EP\EpProducts\Service; use EP\EpProducts\Domain\Model\Hotel; use EP\EpProducts\Domain\Model\Product; use EP\EpProducts\Domain\Repository\DateRepository; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; /** * Lists the pickup points of a product's latest upcoming end-customer date that @@ -16,6 +17,11 @@ use EP\EpProducts\Domain\Repository\DateRepository; * * The returned shape is meant to be served by MyE&P later on, so that only the * data source has to change once the local date table goes away. + * + * Switched by pickupsOverviewEnabled in the extension configuration. A missing + * key means off: a key added to ext_conf_template.txt is absent until the + * extension configuration is saved in the backend, and the overview must not + * go live before it is approved. */ class PickupOverviewService { @@ -24,9 +30,16 @@ class PickupOverviewService */ private $dateRepository; - public function __construct(DateRepository $dateRepository) + /** + * @var bool + */ + private $enabled; + + public function __construct(DateRepository $dateRepository, ExtensionConfiguration $extensionConfiguration) { $this->dateRepository = $dateRepository; + $configuration = (array) $extensionConfiguration->get('ep_products'); + $this->enabled = (bool) ($configuration['pickupsOverviewEnabled'] ?? false); } /** @@ -35,7 +48,7 @@ class PickupOverviewService public function getOverview(Product $product, ?Hotel $hotel): array { $overview = ['pickups' => []]; - if ($hotel === null || $product->isDaytrip()) { + if (!$this->enabled || $hotel === null || $product->isDaytrip()) { return $overview; } diff --git a/public/typo3conf/ext/ep_products/ext_conf_template.txt b/public/typo3conf/ext/ep_products/ext_conf_template.txt index 37e6e943..7a1707ab 100644 --- a/public/typo3conf/ext/ep_products/ext_conf_template.txt +++ b/public/typo3conf/ext/ep_products/ext_conf_template.txt @@ -1,6 +1,9 @@ # cat=General; type=int; label=Searchresult PID searchPageUid = 0 +# cat=General; type=boolean; label=Show the bus pickups table on product detail pages +pickupsOverviewEnabled = 0 + # cat=MyEp; type=string; label=MyE&P URL myEpUrl = https://my.ep-reisen.de