So, I installed Custom Tokens on top of the 7.x-1.1 version of Token (on a Drupal 7.12 install), and not only is there no option appearing in 'Structure' to create the tokens, but I get this when I check my status reports:

Tokens Problems detected
The following token types do not have any tokens defined:

$info['tokens']['custom']

Everything I'm reading on this issue says I should put the issue in the module that is being declared in 'Problems Detected'. Does anyone know how I might fix this?

Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vstmusic’s picture

Same problem for me !

gaspaio’s picture

Have you emptied the menu cache ? when you install a module via drush it doesn't rebuild the menu cache, so the new menu entries are not visible.

vstmusic’s picture

Same problem with empty menu cache.

gaspaio’s picture

You're right. Token seems to consider this situation a coding error.

The only solution i can think of (besides changing Token) is adding a example custom token on install to prevent confusion.

Any other ideas ?

katannshaw’s picture

Having the same problem with Drupal 7.15 and Custom Tokens 7.x-2.0-beta2.

I've tried emptying the cache to no avail.

gaspaio’s picture

Component: Miscellaneous » Code
Assigned: Unassigned » gaspaio
Category: support » bug
FileSize
3.96 KB

I propose to remove the default "custom token" type.
On install no custom types will exist, so you'll have to attach custom tokens to existing types or create on manually.
The Fallback token type becomes "Site information", i.e. If you delete a custom token type, all custom tokens with that type will get "Site information" as a type.

FreeFox’s picture

I had the same error and with the info above I had the idea and tried to add a custom token with title and description the word "test" and the body (code) left blank. I saved it and the error was gone.

polskikrol’s picture

Version: 7.x-2.0-beta2 » 7.x-2.0-beta3

Same issue confirmed in 7.x-2.0-beta3. Its funny, because the module creates a default Custom Token Type called 'Custom', but I have no interest in this. Added a few new tokens of type 'site' to extend those tokens. Works fine.

Problem is that you cant delete this default 'Custom' token type and it presents errors in Status Report checking.

polskikrol’s picture

Looks like bastard is coded in the module.... I tried to clear the cache via MySQL and it comes back again!

truncate table cache_token;

To make matters worse, its no in the configuration table token_custom!

Yeah, this is a module fix! Check out token_custom.module:

// Load token types and make sure the custom type is always there,
// and wasn't deleted somewhere.
$types = variable_get('token_custom_types', array());
if (!isset($types[TOKEN_CUSTOM_DEFAULT_TYPE])) {
$types[TOKEN_CUSTOM_DEFAULT_TYPE] = $default_type;
}

There, you cant get rid of it! Why.... I do not know. Perhaps module maintainer can explain.

mgifford’s picture

Status: Active » Needs review

I got it too in 7.x-2.0-beta3+0-dev.

gaspaio’s picture

Has anybody tested the patch ? It should solve your issues.
If you do and it looks OK i'll commit it.

mgifford’s picture

I applied the patch, cleared cache and still saw this on the Status report page:

The following token types do not have any tokens defined:
    $info['tokens']['custom']

I got this note as part of the application:
can't find file to patch at input line 40

But all 5 hunks were applied.

gaspaio’s picture

Following Drupal conventions, the patch is build against the latest dev version.
It should be applied from the module directory, using the command : patch -p1 < token_custom-no_tokens_for_custom_type-1664456-4.patch

I can't reproduce your error. I am doing something wrong or are you ?

mgifford’s picture

I applied the patch to my working environment not against dev. I'll try to take a look at this again later.

polskikrol’s picture

If someone deletes the Custom Token type, would it not make sense to throw a warning and show which defined tokens would also be deleted by the removal of the Custom Token type? Otherwise, maybe mark it as 'undefined', I would be hesitant to define a default like that.

maximpodorov’s picture

Any progress here?

Christopher Riley’s picture

I added a "Test" token and the warning on the status report page disappears. Maybe on install there should be a sample generated.