I tried to use the same *.tokens.inc I'm using in Google analytics in Piwik, but if configured I receive below notices:

Notice: Array to string conversion in token_replace() (line 95 of drupal7\includes\token.inc).
Notice: Array to string conversion in token_replace() (line 95 of drupal7\includes\token.inc).
Notice: Array to string conversion in token_replace() (line 95 of drupal7\includes\token.inc)

and the resulting code is wrong (_paq.push(['setCustomVariable', 1, "User roles", "Array"]);). Is it not possible to use the same token names in more than one module if they are really the same? Renaming the tokens to a unique name works, but than some users may use [current-user:role-names] from Google Analytics module in Piwik or vice versa. Dependencies may break than... so - why is it not possible to have two identically tokens names from different modules with the same data?

Comments

hass’s picture

Category: bug » support

Maybe more support question...

dave reid’s picture

Status: Active » Fixed

Because module_invoke_all uses array_merge() which combines two array values that have the same keys into an array value.

See #1061714: Improve checking for token definition problems

hass’s picture

So different modules should not define the same token placeholder?

greggles’s picture

So different modules should not define the same token placeholder?

Correct.

Status: Fixed » Closed (fixed)

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