I originally posted this here: http://drupal.org/node/484340#comment-2642646 but decided it might be better handled as its own issue.
I was having trouble with not all of the node tokens appearing in contexts. In plugins/contexts/node.inc, the reset() call in function ctools_context_node_convert_list() only returns the first element of the token list.
This patch flattens the results of token_get_list('node') so that all tokens are available.
This patch is for version 6.x-1.3
| Comment | File | Size | Author |
|---|---|---|---|
| flatten-token-list.patch | 825 bytes | astreib |
Comments
Comment #1
merlinofchaos commentedSetting proper status
Comment #2
merlinofchaos commented1) 1 letter variable names are always wrong. $k/$v is useless. I don't intrinsically know what the key/value is. Real variable names are needed.
2) Are node tokens the only ones that need flattening? Maybe this should be a general helper function that we use to get tokens all the time. Instead of token_get_list, we can use ctools_token_get_flat_list or something, and then make this apply to user tokens as well.
3) It's difficult to test this without knowing what tokens actually don't show up. Reproduction instructions would help.
Comment #3
japerryClosing this issue as outdated as Drupal 6 ctools is not supported. If this issue is relevant for Drupal 7, feel free to re-open and mark for Drupal 7 (or 8)