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

FEATURE: Add helpers to fetch nodes in ways similar to context() operation #5100

Open
kdambekalns opened this issue May 27, 2024 · 5 comments
Assignees
Labels

Comments

@kdambekalns
Copy link
Member

kdambekalns commented May 27, 2024

Description

Prior to Neos 9 it was possible to use the context() operation to fetch nodes, e.g. from a different workspace or in different dimension values. This was useful e.g. if you need to create a link to such a node.

With Neos 9 the context() operation no longer exists, a new, possibly improved way should be made available.

Ideally the new way could be added to a potential Neos 8.4 to make it forward-compatible.

Current state

In Neos9-beta10 and before a hard to decipher error is shown, indicating that context does not exist.

Method "context" is not callable in untrusted context

Possible Solution

  • q(node).inWorkspace('live') to fetch a node in a certain workspace
  • to fetch a node with a certain set of dimension values
  • to include invisible nodes in the results
  • …?
@kdambekalns kdambekalns self-assigned this May 27, 2024
@kdambekalns
Copy link
Member Author

I'm willing to coordinate and hopefully implement this. I need your help, though, to come up with a nice API. So let's hear your suggestions for the operations we need…

@Sebobo
Copy link
Member

Sebobo commented May 27, 2024

I use the same three as in your list. So here my first quick suggestions:

How about withDimensionsCombination(<dimensions>[, <targetDimensions>]) for something like this:

q(site).context({'dimensions': this.dimensions.dimensions, 'targetDimensions': this.dimensions.targetDimensions})

And includeInvisible([<bool>]) to replace q(node).context({'invisibleContentShown': true})

@mhsdesign
Copy link
Member

regarding legacy invisibleContentShown:

Regarding includeInvisible([<bool>]) we should definitely use the disabled naming here (#4312) and we actually prepared with the introduction of subtree tags new possibilities than just disabled and not disabled but also custom subtree tags. That should ideally be also reflected via the api but there might be an abstraction to simplify the disabled case:

q(node).withoutDisabled()
q(node).withDisabled()

and generic tags:

q(node).withRestrictedVisibility([])
q(node).withRestrictedVisibility(['disabled'])

i found it actually super hard to think of the namings here and until bastians cr privileges are done it might be to soon to advance here ... unless of course well coordinated.

regarding targetDimensions

i have to ask bernhard but one just uses a full dimension space point here ... so the api would be

withDimension(['language' => 'en'])

Fyi regarding dimension we already also have this eel helper in place which can do a lot of crazy stuff (for neos seo)

Neos.Dimension.findVariantInDimension(node, 'language', 'en_UK')

@kdambekalns
Copy link
Member Author

@mhsdesign
Copy link
Member

#5130 would reintroduce the 8.3 syntax for workspaceName, dimensions, invisibleContentShown (untested yet)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

3 participants