From 874b9f707a04160050aaa96c18dacbaa47955ad5 Mon Sep 17 00:00:00 2001 From: Martin Ficzel Date: Thu, 14 Sep 2023 19:40:19 +0200 Subject: [PATCH] TASK: Adjust migration for user interface mode the migration previously adjusted the code to a now deprecated eel helper. In pr https://github.com/neos/neos-development-collection/pull/4505 the userInterfaceMode is introduced as global fusionValue which made an adjustment in the rector necessary. `(node|documentNode|site).context.inBackend` is now migrated to `userInterfaceMode.isEdit` `(node|documentNode|site).context.live` is now migrated to `userInterfaceMode.isLive` In cases where it cannot be determined wether a node is affected by the `context` operation a comment is added as before. --- .../Rules/FusionContextInBackendRector.php | 4 ++-- src/ContentRepository90/Rules/FusionContextLiveRector.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ContentRepository90/Rules/FusionContextInBackendRector.php b/src/ContentRepository90/Rules/FusionContextInBackendRector.php index ebcc196..7abd7d8 100644 --- a/src/ContentRepository90/Rules/FusionContextInBackendRector.php +++ b/src/ContentRepository90/Rules/FusionContextInBackendRector.php @@ -20,12 +20,12 @@ public function refactorFileContent(string $fileContent): string return EelExpressionTransformer::parse($fileContent) ->process(fn(string $eelExpression) => preg_replace( '/(node|documentNode|site)\.context\.inBackend/', - 'Neos.Node.inBackend($1)', + 'userInterfaceMode.isEdit', $eelExpression )) ->addCommentsIfRegexMatches( '/\.context\.inBackend/', - '// TODO 9.0 migration: Line %LINE: You very likely need to rewrite "VARIABLE.context.inBackend" to Neos.Node.inBackend(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node.' + '// TODO 9.0 migration: Line %LINE: You very likely need to rewrite "VARIABLE.context.inBackend" to "userInterfaceMode.isEdit". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.' )->getProcessedContent(); } } diff --git a/src/ContentRepository90/Rules/FusionContextLiveRector.php b/src/ContentRepository90/Rules/FusionContextLiveRector.php index 3d2fed9..d754a9e 100644 --- a/src/ContentRepository90/Rules/FusionContextLiveRector.php +++ b/src/ContentRepository90/Rules/FusionContextLiveRector.php @@ -20,12 +20,12 @@ public function refactorFileContent(string $fileContent): string return EelExpressionTransformer::parse($fileContent) ->process(fn(string $eelExpression) => preg_replace( '/(node|documentNode|site)\.context\.live/', - 'Neos.Node.isLive($1)', + 'userInterfaceMode.isLive', $eelExpression )) ->addCommentsIfRegexMatches( '/\.context\.live/', - '// TODO 9.0 migration: Line %LINE: You very likely need to rewrite "VARIABLE.context.live" to Neos.Node.isLive(VARIABLE). We did not auto-apply this migration because we cannot be sure whether the variable is a Node.' + '// TODO 9.0 migration: Line %LINE: You very likely need to rewrite "VARIABLE.context.live" to "userInterfaceMode.isLive". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.' )->getProcessedContent(); } }