Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
}
Expand All @@ -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());
}
}
Expand Down
Loading