Skip to content

Commit

Permalink
TASK: Adjust migration for user interface mode
Browse files Browse the repository at this point in the history
the migration previously adjusted the code to a now deprecated eel helper. In pr neos/neos-development-collection#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.
  • Loading branch information
mficzel committed Sep 14, 2023
1 parent b046f7e commit 874b9f7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
4 changes: 2 additions & 2 deletions src/ContentRepository90/Rules/FusionContextLiveRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 874b9f7

Please sign in to comment.