-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
FEATURE: Fusion renderingMode
semantic correct inBackend
#4396
Comments
inBackend
inBackend
I see two lines of arguing here: Option 1: Your line of thought that basically replaces it with "edit or preview mode", but in that case I really think we should offer the syntactic sugar of Option 2: we assume that |
Im for Option 2, as And thus when we use |
I also would prefer the strictness of option 2 since we usually mean the editMode. An If we decide to add a convenience method i would prefer to call it |
I also prefer option 2 (and support the proposal in general) 👍 Thanks for taking care! |
this is another implementaiton problem we have right now, IMHO it should not and the PR from martin should fix that. |
@mhsdesign Can we get this to a done state? Seems we agree on a solution here :) (or did I overlook the solution already?) All the best! |
#4505 will actually only solve half of it. We have several places in php where we check against the live content stream (which as written above should NOT say anything about if the node is in backend or not!) neos-development-collection/Neos.Neos/Classes/Service/ContentElementWrappingService.php Line 98 in 4b9c5bf
|
inBackend
inBackend
…IsEditChecksInsteadOfNodeIsLive TASK: #4396 prefer renderingMode::isEdit over node::isLive
inBackend
renderingMode
semantic correct inBackend
I created a followup issue for all the leftover problems that are now fixable with the newly introduced concept of the I updated the issues description and consider this part closed. |
current
inBackend
statecurrently in 8.3 and 9.0-dev we check if a node is in the backend by checking if the workspace is not live.
In Neos 8.3 it looks like
node.context.inBackend
and for Neos 9.0-dev of July 2023 we currently use
Neos.Node.inBackend(node)
.The edit preview modes are at this time not implemented in Neos 9 (see #4086).
The assumption that nodes in non-live workspaces should render in backend mode is understandable but not fully semantically correct.
It currently happens to be that way that one cannot directly edit the live workspace via Neos Ui or that workspaces cannot be rendered in frontend mode, but it should not be fundamentally impossible.
problems workspace determined check
inBackend = !workspace.live
The workspace based rendering logic works well for when editing nodes in the Ui and rendering live nodes only for frontend.
But the downside is that the external preview mode will still be treated as
inBackend
.It's not possible to render every workspace for frontend.
Without any content element wrapping and possible backend notes.
Also, the node uris are not correctly rendered see: #2347
The current workaround in 8.3 is to check if the preview is in
user-admin
or in its base workspace, as the "Show preview" will always show the node in its base workspace (seeNodeInfoHelper::createRedirectToNode
):problems of the 8.3 rendering mode attached to the nodes context
Accessing the actual rendering mode in fusion is done via
node.context.currentRenderingMode.edit
which is implemented here:neos-development-collection/Neos.Neos/Classes/Domain/Service/ContentContext.php
Lines 168 to 171 in bc68159
But this always requires the rendering mode to be set globally and it cannot be changed individually for one rendering.
A separate variable is preferred.
proposed solution with Neos 9
With 9.0 we have a chance to clean this up. Using
node.context.inBackend
won't work anymore as Neos 9 doesnt have acontext
, and the check has to be migrated either way.(currently this is done via rector toNeos.Node.inBackend(node)
)The concept of custom Fusion global variables would allow us to introduce node/request independent helpers like
renderingMode.isEdit
andrenderingMode.isPreview
.The introduction of the
renderingMode
per se will not solve the above outlined problem fully, but we would also have set therenderingMode
to not edit if we use the "Show Preview" button.Followup issue: #4959
Discussions about implementation
Fusion global vs regular Fusion context variable
Introducing Fusion globals to allow a
request
like global is important so the variable is always available and will not be "lost" if not specified in@cache.mode = 'uncached'
segments.A "regular" Fusion context variable would have to be breaking and would need manual adjustments in every dynamic and uncached cache configuration:
We also discussed to introduce a default cache context like
Neos.Fusion:GlobalCacheIdentifiers
so this is less breaking but discarded this idea at the dresden sprint 23.Fusion global vs attached to
request
Silently attaching the rendering mode to the
request
or worse having some singleton and eel helper to fetch it will make custom use cases of rendering a page super tricky. We would have to expect a similar workaround like this now reverted change: neos/neos-ui@ce395caPassing the rendering mode explicitly from outside will hopefully solve that two tabs can have a distinct rendering mode which is not determined by the session: #965
migration
We discussed to remove our "temporary" 9.0-dev method
Neos.Node.inBackend(node)
and replace it withrenderingMode.isEdit
A simple migration for current 9.0 projects can be done by hand or via a regex replace from
Neos.Node.inBackend\([a-zA-Z]*\)
torenderingMode.isEdit
.The rector migration neos/rector#22 will take care of migrating
node.context.inBackend
torenderingMode
for Neos 8.3implementation
FusionGlobals
isBackend
checks in php land to use the current rendering mode. For example inside content element wrapping service.renderingMode.isEdit
inNodeController
The text was updated successfully, but these errors were encountered: