Project:Custom Tokens
Version:6.x-1.2
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I'm trying to use Custom Tokens inside nodes, and everything appears to be fine, except that $node doesn't appear to be defined.

The token has its type set to node, but when I use var_dump($node), it prints NULL. I've also tried switching it to be a global token, but that doesn't fix my issue. Other PHP code works fine in other tokens.

I've attached screenshots of the relevant token and node edit forms, as well as the node itself.

Is there something I'm doing wrong, or is this functionality just not working?

AttachmentSize
Token edit form29.29 KB
Node output5.65 KB
Node edit form9.2 KB

Comments

#1

It seems that you are using some kind of token filter? is it token_filter module? It might be an issue on their module, but I'll have to check that out.

#2

Yes, I am using token_filter as well. I thought it was working, but I'm probably wrong. How would I check to see which module is causing the problem?

Is there any way I can use tokens within nodes without having to use a filter?

#3

if you are developer, you'll have to check both modules and see where is glitch. I may not be a problem of either module, but something between that particular use that you are giving to both is raising a conflict. Hopefully by debugging both modules you'll be able to find a problem.

Now, I am wondering why would you use a custom token to replace something within a node where you can use PHP evaluation for that. It may not be a the exact same behavior as using token as a filter but you'll certainly work things out.

#4

I'm comfortable with custom PHP myself, but I'm not comfortable handing that level of control over to my users. I'd rather develop custom tokens for them and show them how to use them. Security stays in my hands then, rather than theirs.

I'll keep working on it, but I think token_filter is the issue. Apparently node tokens have never really worked with it. I may end up writing my own module to do token replacements.

#5

That'd be OK, but if you can collaborate with token_filter and improve it that might be the best way.

#6

Status:active» closed (fixed)

closing this issue as it's probably not related to this module.