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

Comments

eaton’s picture

Status: Needs review » Fixed

This 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!

smk-ka’s picture

Status: Fixed » Needs review
StatusFileSize
new3.23 KB

This 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.

smk-ka’s picture

token_get_help() should actually read theme_token_help()...

smk-ka’s picture

...and to complete the confusion: token_get_types() is actually called token_get_list() in the code :P

smk-ka’s picture

StatusFileSize
new3.01 KB

Re-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.

druvision’s picture

Title: Replace multiple types » Replace multiple delimiter types

+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 :)

smk-ka’s picture

Title: Replace multiple delimiter types » Display token_help for more than one type

Umm.. 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).

MGN’s picture

Any 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!

quicksketch’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new2.74 KB

This 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.

quicksketch’s picture

Exhibit A: Flag's work-around theme functions that this would make unnecessary.

MGN’s picture

StatusFileSize
new2.59 KB

Here 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

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Fixed http://drupal.org/cvs?commit=218736

Thanks, everyone.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.