- Issue created by @marco aurelio rocca
- 🇩🇪Germany jurgenhaas Gottmadingen
Well, there is no token provided by either of the events you're mentioning. Following the token chapter in ECA Guide (https://ecaguide.org/eca/concepts/tokens/) you need to load the tokens you want to use in your model explicitly. In your case, the https://ecaguide.org/plugins/eca/misc/actions/eca_token_load_route_param action may be a good fit.
- 🇧🇷Brazil marco aurelio rocca
Is that different from previous versions of ECA? o_O''
Let me describe a situation that works today, running well on production site with Drupal 10.2.7 with ECA 1.1.9:- model starts with event = CONTROLLER FOUND TO HANDLE REQUEST
- from Event to Gateway, the Arrow has a template = ROUTE MATCH, and here I have fields set to give me an answer like: "is this route name ENTITY.NODE.CANONICAL?"
- from Gateway 1 I have an arrow towards Gateway 2, and this arrow has a template = COMPARE SCALAR VALUES, and there I do have a token equals to [entity.nid], which I compare to a specifica integer number
- from this on, the model flows
This thing works well today, on PROD site, with the [entity] token being recognized and the "entity.node.canonical" route name being known to the ECA model.
If things have changed about these features, and those pieces of information will no more be available this way, it means I CANNOT upgrade Drupal + ECA version on this prod-site, is it so? o_O"
- 🇩🇪Germany jurgenhaas Gottmadingen
No, nothing has changed in that regard. And from the 4 steps you describe, it is impossible that ECA knows any token that could be a node or other entity. Can you export that model and upload here for review?
- 🇧🇷Brazil marco aurelio rocca
I exported the model, there are many dependencies related to the specific site we have here, hope it helps!
Unsure that the export may be of real use, I tried some screens also! - 🇩🇪Germany jurgenhaas Gottmadingen
I can't load that model, as it is really huge and as you said, has too many dependencies.
But I scanned through that model in an editor, and it does read an ID value from the URL with the token
[current-page:query:supimpa]
and then loads the node with that ID into a token callednodesolicitacao
. It then uses that token for further actions.So, that's what needed to be done because otherwise no token for a node would be available. And that's still the same in ECA 2 as well.
- 🇧🇷Brazil marco aurelio rocca
i'll clone that huge model and strip it of everything else... then try to understand whether or not it still works, and try to export it into here, again, if you allow me.
That moment, when [current-page:query:supimpa] is checked, is already a third step of the Model, of further yet, after I have already asked for a specific Route (and it seemengly said: "yes!") and after I have asked for a specific NID from the Entity loaded in the page (and it said "yes!")... I cant understand how it would have succeeded to get as far as that [current-page:query:supimpa] is not Entity is loaded in the scope.
Let me bring another shorter version of the Model, soon.
- 🇧🇷Brazil marco aurelio rocca
Let me correct my previous text:
... I cant understand how it would have succeeded to get as far as that [current-page:query:supimpa] if no Entity token is loaded in the scope.
- 🇩🇪Germany jurgenhaas Gottmadingen
When you add
[entity:nid]
to one of your messages, you can see that its output is empty. So, that token doesn't exist.But that model has even more issues:
You will get the message "not entity.node.canonical!" more often than you may expect. It will be shown on node pages every second time, because there is also always the request to
/history/[NID]/read
which doesn't match the routeentity.node.canonical
and that will result in your first condition to be false, and therefore this creates that message which will then be shown for the next page request of the same user, even if they are on a node page.Then, your scalar comparison of
[entity:nid]
and23915
will return FALSE, even if you negate the condition. This is because you're forcing a numeric comparison. And comparing either an empty value or the value[entity:nid]
in a numeric type will always return FALSE, regardless of the negate setting. - 🇧🇷Brazil marco aurelio rocca
Wow... that's far more than I would infer... :(
My point, from the very beginning, was to have a Model that does something like
"Hey, cool, this is a NODE page! Give me this node's data in my hand, so that I can use its information to do this or that"...Is there a simple way to achieve this?
- 🇩🇪Germany jurgenhaas Gottmadingen
Is there a simple way to achieve this?
As I suggested in #2 you can load a route parameter into a token. That's all you need.
- 🇧🇷Brazil marco aurelio rocca
As the page called was already /node/[nid], I assumed that this entity was already to be found loaded into some variable that I could get my hands on (maybe using some other Event as a trigger), so that I could avoid loading it "again".
But ok, then!
I used "Controller found to handle request" as the Event, then Action "Request: Get path argument", and it did work.
Thank you once more!
Automatically closed - issue fixed for 2 weeks with no activity.