Closed (fixed)
Project:
Token
Version:
5.x-1.6
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
12 Mar 2007 at 17:20 UTC
Updated:
13 Jun 2009 at 20:40 UTC
Jump to comment: Most recent file
Continuation from this issue (Add profile support).
Without much ado I've implemented token_replace_multiple() as proposed - it takes an array of types that should contain type => object pairs. Also updated the documentation accordingly.
Patch is against CVS DRUPAL-5, not version 1.6 as indicated.
--
Stefan Kudwien
www.unleashedmind.com
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 127072_token-6.x_multiple_help.diff | 2.59 KB | MGN |
| #9 | token_help_multiple5.patch | 2.74 KB | quicksketch |
| #8 | token-6.x-1.11-help_multiple-1098174.diff | 2.6 KB | MGN |
| #5 | token-get-help_0.patch | 3.01 KB | smk-ka |
| #2 | token-get-help.patch | 3.23 KB | smk-ka |
Comments
Comment #1
eaton commentedThis has been committed to the dev branch. I've done some smoke testing on it, and the code appears simple enough, but I'd like to give it a few days, perhaps a week, before rolling an official 1.7 release that includes the feature. Thanks for the great work!
Comment #2
smk-ka commentedThis one requires some more work: token_get_help() should also be able to handle multiple $types, not only one as it currently does.
Fortunately, the changes are 100% backwards compatible. The major change is in token_get_types(), where $types is converted to an array and iterated over to retrieve all tokens. The rest of the changes are mostly documentation updates.
Example of new functionality:
$output = token_get_help(array('user', 'profile', 'invite'));returns the rendered help table for user, profile, invite, and global tokens.
Comment #3
smk-ka commentedtoken_get_help() should actually read theme_token_help()...
Comment #4
smk-ka commented...and to complete the confusion: token_get_types() is actually called token_get_list() in the code :P
Comment #5
smk-ka commentedRe-rolled patch against current DRUPAL-5 branch. Anybody there to review this issue? The ability to show help for more than one token type is a requirement for the transition of Invite module to make use of tokens, so this and profile support are currently blocking further development.
Comment #6
druvision commented+1 for your idea.
I want to add that multiple delimiters must be supported by default.
Supporting multiple default delimiters is essential for backward compatibility.
The new default token delimiters ([]) breaks TONS of old translations (take a look at my issue).
Let's add default support for the previous % prefix convention, otherwise we are causing
tons of extra work for translators and other incompatibilities.
Amnon
-
Professional: Drupal Search | Drupal Israel | Web Hosting Strategies
Personal: Hitech Dolphin: Regain Simple Joy :)
Comment #7
smk-ka commentedUmm.. the topic obviously was misleading, so I've changed it.
This issue is not about multiple delimiters (dunno why I used it in the title though :P), but multiple $types passed in to theme_token_help(). As it's currently only possible to display the help for either one domain type, or all (which - in most cases - is too much).
Comment #8
MGN commentedAny reason why this issue lies dormant? I've manually patched 6.x-1.11 with the code in #5 and it works fine. I like this for the reasons described in #7, it lets you fine tune the list of tokens displayed by theme_token_help. For example, with this modification,
theme('token_help', array('node', 'user')),shows a list of node and user tokens. Thanks to smk-ka for this helpful addition!Comment #9
quicksketchThis patch works great for me. It'd be nice to get in because Flag module has had a work-around for this exact situation for months and months. It'd be great to take it out. It also made testing the patch really easy though, since we're already using this exact function for multiple token types. MGN's version worked perfectly, here's a reroll for the D5 version.
Comment #10
quicksketchExhibit A: Flag's work-around theme functions that this would make unnecessary.
Comment #11
MGN commentedHere is a re-roll of the patch in #8 against the latest 6.x-1.x-dev version. The issue has been on the queue for more than two years now. It would be great if the maintainers would provide some feedback on this.
Thanks
Comment #12
gregglesFixed http://drupal.org/cvs?commit=218736
Thanks, everyone.