I created a relation type between a source user and target node. When the relation is created I have a rule that creates a Message entity and adds a reference to the relation via an entity reference field called field_application. This all works fine, until I try to set up the message text using tokens. In the list of available tokens, I see entries for tokens such as [message:field-application:endpoints-target-node] which appear to represent the node referred to by the endpoint but (1) it's not chained, so there are no tokens listed such as [message:field-application:endpoints-target-node:title] and (2) if I attempt to use it it's not resolved and in the code there's a EntityMetadataWrapper exception thrown as "endpoints-target-node" is not listed in the properties for the entity wrapper.

I have not been able to work out where in the code these tokens are getting added to the info, but I assume it must be something to do with this module. For the moment I am working round it with some custom code in a module of my own which resolves these tokens, but it would be much better if there was proper token support for the endpoints field.

Comments

mikran’s picture

Category: Bug report » Feature request
Issue summary: View changes

I'd imagine that token is coming from token module itself. Relation endpoint module does not add any tokens so changing this to 'Feature request'.

alfaguru’s picture

The way tokens arise now is complex. A lot of them are generated automatically by the Entity API, and I suspect that in this case it is that properties are being declared somewhat incompletely. The Entity API is a bit of a nightmare so it's easy to miss something when using it.

That property "endpoints-target-node" is definitely being generated from your module somehow, so if you wouldn't mind looking again at how you are using the Entity API I'd appreciate it.