Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Adjust migration for renderingMode.isEdit #22

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
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 @@ -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)',
'renderingMode.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 "renderingMode.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)',
'!renderingMode.isEdit',
$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 "!renderingMode.isEdit". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'
)->getProcessedContent();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Fie
}
}
-----
// TODO 9.0 migration: Line 26: 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 26: You very likely need to rewrite "VARIABLE.context.inBackend" to "renderingMode.isEdit". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {

renderer = Neos.Fusion:Component {

#
# pass down props
#
attributes = ${Neos.Node.inBackend(node) || Neos.Node.inBackend(site) || Neos.Node.inBackend(documentNode)}
attributes = ${renderingMode.isEdit || renderingMode.isEdit || renderingMode.isEdit}

#
# the `checked` state is calculated outside the renderer to allow` overriding via `attributes`
Expand All @@ -54,10 +54,10 @@ prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Fie
renderer = afx`
<input
type="checkbox"
name={Neos.Node.inBackend(node)}
name={renderingMode.isEdit}
value={someOtherVariable.context.inBackend}
checked={props.checked}
{...Neos.Node.inBackend(node)}
{...renderingMode.isEdit}
/>
`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Fie
}
}
-----
// TODO 9.0 migration: Line 26: 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 26: You very likely need to rewrite "VARIABLE.context.live" to "!renderingMode.isEdit". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.
prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Field) {

renderer = Neos.Fusion:Component {

#
# pass down props
#
attributes = ${Neos.Node.isLive(node) || Neos.Node.isLive(site) || Neos.Node.isLive(documentNode)}
attributes = ${!renderingMode.isEdit || !renderingMode.isEdit || !renderingMode.isEdit}

#
# the `checked` state is calculated outside the renderer to allow` overriding via `attributes`
Expand All @@ -54,10 +54,10 @@ prototype(Neos.Fusion.Form:Checkbox) < prototype(Neos.Fusion.Form:Component.Fie
renderer = afx`
<input
type="checkbox"
name={Neos.Node.isLive(node)}
name={!renderingMode.isEdit}
value={someOtherVariable.context.live}
checked={props.checked}
{...Neos.Node.isLive(node)}
{...!renderingMode.isEdit}
/>
`
}
Expand Down