Is it possible to create a dynamic startingPoint in the reference editor

I’ve got a question about the reference editor and the startingPoint :
I want to set the startingPoint relative to the current NodeMy first try was to set it with an eel expression:

startingPoint: "${q(node).parent().property('_path')}"

But this doesn’t work. Then I tried it with ClientEval

startingPoint: "ClientEval:node.properties._path.replace(/(.+)(\\/.+)/, '$1')"

With that configuration, I was able to set the startingPoint to the parent node. I was aware that this will work not in the creationDialog , but that’s ok.

Everything seems to work fine, and I was so happy about this, as I want to solve this problem many times. But : If I have set some references they will not show up if I reload the document, it is always empty…

Now my Question:
Is it somehow possible the enable Eel on this setting? Ii really like the reference editor, but this is clearly a missing feature (or a bug…)

Hey Jon,

also needed to solve that problem for a customer project some time ago and I also thought to make the setting eel-aware. The problem is though, that the NodeTypeConfiguration is cached and not document-Node specific. So evaluating an eel-query is not possible and wouldn’t even be a good idea performance wise.

In my case, the calculated starting point / context Node didn’t depend on the current page so I AOPd Neos\Neos\Controller\Service\NodesController->indexAction and changed the starting point when the search request to the backend was performed.

I extracted the code to a Gist, maybe it helps:

Cheers,
Daniel

1 Like

Hi Daniel,

Thanks you a lot for your answer!

That means, I have to calculate the parent node on $contextNode = // YOUR CALCULATION HERE;?

Do you have a small hint how I can achieve this? I’m still a bit the PHP dummy :wink:

Just what I wrote in https://neos-project.slack.com/archives/C0U0KEGDQ/p1584963644082200:

Interesting bug(?) with the reference property editor… I use

startingPoint: 'ClientEval: node.properties._path'

to limit search to subnodes of a document. That works fine, but when loading the document, the editor tries to initialize using the literal string ClientEval: node.properties._path as context node, which of course does not work. Seems like a problem with initialization order?!

Yes, I think it should check if the string starts with ‘ClientEval’ and if it does, don’t set the context node

Where does this initialization happens?