From f89386a1fe5aed908b26308108e87dc3b679ee9c Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Mon, 17 Aug 2026 21:32:28 +0200 Subject: [PATCH] fix typo in target group editable selection --- .../ResetEditablesSessionHandler.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Handler/Document/Page/ResetEditablesSession/ResetEditablesSessionHandler.php b/src/Handler/Document/Page/ResetEditablesSession/ResetEditablesSessionHandler.php index cbcebd20..d4f0d9d4 100644 --- a/src/Handler/Document/Page/ResetEditablesSession/ResetEditablesSessionHandler.php +++ b/src/Handler/Document/Page/ResetEditablesSession/ResetEditablesSessionHandler.php @@ -35,6 +35,12 @@ final class ResetEditablesSessionHandler { + /** + * Mirrors TargetingDocumentInterface::TARGET_GROUP_EDITABLE_PREFIX. + * Hardcoded because the personalization bundle may not be installed + */ + private const string TARGET_GROUP_EDITABLE_PREFIX = 'persona_-'; + public function __construct(private readonly ElementDraftService $elementDraftService) { } @@ -49,8 +55,7 @@ public function __invoke(ResetEditablesSessionPayload $payload): void foreach ($doc->getEditables() as $editable) { // remove all but target group data - // Hardcoded the TARGET_GROUP_EDITABLE_PREFIX prefix here as we shouldn't remove the bundle specific editables even if bundle is not enabled/installed - if (!preg_match('/^' . preg_quote('persona_ -', '/') . '/', $editable->getName())) { + if (!str_starts_with($editable->getName(), self::TARGET_GROUP_EDITABLE_PREFIX)) { $doc->removeEditable($editable->getName()); } }