Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For instance, we want the 'book page' token type to extend the 'menu item' token type, but also add its own 'bid' token that does not apply to all menu links.
Comment | File | Size | Author |
---|---|---|---|
#2 | 975112-token-extend-types.patch | 7.84 KB | Dave Reid |
Comments
Comment #1
Dave ReidThink I've actually got this. I thought I'd have to do a whole bunch of token type dependency parsing and graphing, but I don't think that it's likely we'll have a two-deep token type dependency. If so, I have some code ready for that.
Comment #2
Dave ReidComment #3
Dave ReidSweet!!! Committing #2 to CVS!
http://drupal.org/cvs?commit=466256
The example we provide is we want [current-user:ip-address] to return the IP address of the current logged-in user, but [user:ip-address] should not be provided as we have no idea what a single user's IP address is.
If ever this needs to resolve two levels of token type dependencies, here's the code I had started writing:
Comment #4
sbrattla CreditAttribution: sbrattla commentedJust wanted to follow up on this one, as I believe it is closely related to something I've run into.
I've defined a token 'sender' in my hook_token_info() the following way:
What I would expect is that the 'sender' extends 'user', so that all tokens available for a 'user' is available for a 'sender'. When I open up a token browser, this proves to be correct. All tokens which would be available for a 'user' is listed as available for a 'sender'.
However, it seems to stop with that. Tokens available for a 'user' appears to be available for a 'sender' as well (as the token browser says so), but no [sender:X] token is being replaced at all.
I'm uncertain if my issue is related to this issue?
Comment #5
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedThe patch in #2 was committed 8 years ago so changing the issue status to fixed.