Skip to content

Commit

Permalink
Merge pull request #22 from neos/90/adjustMigrationForUserInterfaceMode
Browse files Browse the repository at this point in the history
TASK: Adjust migration for user interface mode
  • Loading branch information
ahaeslich authored Sep 17, 2023
2 parents b046f7e + 7f4b7b6 commit 618a7fd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 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)',
'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

0 comments on commit 618a7fd

Please sign in to comment.