Understanding how flag module tokens relate to ECA flag tokens

Created on 18 May 2023, over 1 year ago
Updated 13 July 2023, over 1 year ago

Problem/Motivation

I am a newbie to ECA and I too am experimenting with ECA flag while working with @SirClickaLot . I too am a little confused about using flag tokens when responding to a flag using ECA.

Step-by-step

I am using ECA to repsond to unflagging.
I am outputting a debug using Drupal core message.
Here is my Custom properties > Message content...

Something was flagged.<br>
The flag was [flag]<br>
The flagging entity was [flagging]<br>
The entity was [entity]<br>
The flag machine readable name is [flag:name]<br>
The flag human readable title is [flag:title]<br>

When the ECA module kicks in and displays the debug message, this is what I see...

Something was flagged.
The flag was completed
The flagging entity was 1234
The entity was 8308
The flag machine readable name is [flag:name]
The flag human readable title is [flag:title]

My confusion is twofold:
Firstly, surely given that I'm logged in as UID 1, the flagging entity ([flagging]) should evaluate to 1, could this be a bit of temporary hard-coding within the ECA flag module in place of looking up the value of the token?

Secondly, I do not understand at all why the standard Flag module tokens ([flag:name] and [flag:title]) are not being converted as well.

Can anyone please help me to understand?

💬 Support request
Status

Fixed

Version

1.0

Component

Documentation

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @missclickalot
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Well, ECA has no hard coding WRT to token replacement at all. Token replacement totally happens in the module which provides the token, the flag module in this case.

    The only speciality in ECA is that a token can have a different name. As an example: if there is the [node:title] token, then the node in what we refer to as the token name. In ECA, your node entity can be stored with an arbitrary name, like e.g. mynode. The, the token to be used would be [mynode:title]. The same applies for flag or flagging, depending on what type of entity you're dealing with.

    As the tokens in reach for your ECA model may come from many different sources, the best technique is to use Debugging described in the ECA Guide. If you then run your model, you can review the logs which will show you in details, what tokens under which name and type have been available to the model at any single step in the process.

  • Thank you for your time on this @jurgenhaas . I now understand why we can't access the values of the flag module related tokens. Thank you again for that.

    I think WRT my first question about the [flagging] token value, I think I misunderstood what it was supposed to be. I thought it was meant to refer to the user who flagged via the UI! I'm still learning this stuff.

    After further experimentation I can see that my thinking 1234 was hard coded was nonsense because I can see that the value is incrementing each time any kind of flagging takes place. Out of interest, please could you help me to understand why we have this incrementing number, and where it is stored because it doesn't appear to be a table?

    Thank you too for pointing me to the documentation, I'll now have a go with web profiler and crack on experimenting and give you more feedback when I can.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I guess the number you're seeing is the ID of the flag entity. Every time, a user flags something, a flag entity gets created and those entities get IDs, which are incrementing numbers.

  • Status changed to Postponed: needs info over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Is this now being resolved or do you need more help on this?

  • Thank you @jurgenhaas , I don't need any more help on this. Thanks again.

  • Status changed to Fixed over 1 year ago
  • 🇩🇪Germany jurgenhaas Gottmadingen
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024