- Issue created by @SirClickALot
- π©πͺGermany jurgenhaas Gottmadingen
Views queries are intentionally returning a list of found entities from the main table of the view, regardless of relationships or fields. This is due to the views architecture:
- the view gets built and queried: this takes all the relationships, context, sorts and filters into account and creates a list of found entities; this is always entities of the view's main table
- the view result gets rendered: here, the display plugin and all the fields (if defined) are taken into account
So, the view query is only about step 1, and it doesn't return anything else than the list of found entities. And that's what the ECA action plugin is supposed to be doing.
It might be possible to provide additional action plugins, that go a step further and also render the view to return the rendered result. But that's not yet on the roadmap and would require some resources to be developed.
- π¬π§United Kingdom SirClickALot Somerset
OK, thanks for the response here @jurgenhaas β but I'm not sure that I fully I understand you correctly.
May I re-phrase in order to try to help...
I know that my view works in the views UI because sending it
8526
as an argument in the UI preview returns8525
which is correct becausenid:8525
refers tonid:8526
.I think that my view IS being sent the correct argument in the ECA as
[this-whiteboard:nid]
because if I temporarily replace the[this-whiteboard:nid]
with an actual nid:852
6
gives the same result.However, when called from within the ECA, the view returns
852
6
instead of852
5
.If I understand you correctly, when the view is called inside the ECA, it (the view) does all its usual contextual filtering / relationships etc. and indeed return a LIST of all candidate entities - which I assume from what you've said is a list of entity IDS?
If that is so (contextual filtering and relationships are all used as expected) then why I am seeing SIX (
852
6
) being returned - that was the originalnid
to it.
From what you've confirmed, I should surely being seeing a list (1 entry only) identifyingnid:852
5
?If I got back the correct ID then I could load the node and get on with the rest but I'm not being sent it.
I'm certain that the correct
nid
is being sent to the view from within the ECA because if I temporarily replace the[this-whiteboard:nid]
with an actual nid:852
6
gives the same result.Sorry to be a continued bother here but I'm a bit stumped.
- π©πͺGermany jurgenhaas Gottmadingen
I can't review all the configurations that we receive in context of support. That's just too time consuming.
When you refer to "it works in views UI", that's comparing apples and pies. The view UI goes through all the steps that I described: it queries the database and then renders the results.
But ECA does only the first step: it queries the DB and DOES NOT render the result. It receives the raw result from the DB query. And if that DB query delivers the wrong result, then either the view is not configured correctly or the arguments provided to the context filter are not correct.
If, instead, you want to receive the rendered result from a view, then you may be interested in the Render: Views action plugin. A nice example was posted in π¬ [eca_views]: How to get the actual View result in ECA Fixed yesterday.
- πΊπΈUnited States freelock Seattle
@SirClickalot is the result you expect in the "main" views table, or in the "relationship" table?
From your results, I'm guessing that argument you're passing in is for the "main" table, and you're using the views relationship to get the related nodes.
If so, you should be able to flip this around -- make the main content type the ones you want to return, make the relationship go the other direction, and then in the argument handler, tell it to use the relationship. This should give ECA the related node instead of the original node...
- Status changed to Fixed
about 1 year ago 2:20pm 22 December 2023 - π©πͺGermany jurgenhaas Gottmadingen
It sounds as if marking this fixed is appropriate. If not, please re-open and let us know what's missing.
Automatically closed - issue fixed for 2 weeks with no activity.