Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#6 | token_custom-no_tokens_for_custom_type-1664456-6.patch | 3.96 KB | gaspaio |
Comments
Comment #1
vstmusic CreditAttribution: vstmusic commentedSame problem for me !
Comment #2
gaspaio CreditAttribution: gaspaio commentedHave 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.
Comment #3
vstmusic CreditAttribution: vstmusic commentedSame problem with empty menu cache.
Comment #4
gaspaio CreditAttribution: gaspaio commentedYou'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 ?
Comment #5
katannshaw CreditAttribution: katannshaw commentedHaving the same problem with Drupal 7.15 and Custom Tokens 7.x-2.0-beta2.
I've tried emptying the cache to no avail.
Comment #6
gaspaio CreditAttribution: gaspaio commentedI 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.
Comment #7
FreeFox CreditAttribution: FreeFox commentedI 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.
Comment #8
polskikrol CreditAttribution: polskikrol commentedSame 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.
Comment #9
polskikrol CreditAttribution: polskikrol commentedLooks 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.
Comment #10
mgiffordI got it too in 7.x-2.0-beta3+0-dev.
Comment #11
gaspaio CreditAttribution: gaspaio commentedHas anybody tested the patch ? It should solve your issues.
If you do and it looks OK i'll commit it.
Comment #12
mgiffordI applied the patch, cleared cache and still saw this on the Status report page:
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.
Comment #13
gaspaio CreditAttribution: gaspaio commentedFollowing 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 ?
Comment #14
mgiffordI applied the patch to my working environment not against dev. I'll try to take a look at this again later.
Comment #15
polskikrol CreditAttribution: polskikrol commentedIf 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.
Comment #16
maximpodorov CreditAttribution: maximpodorov commentedAny progress here?
Comment #17
Christopher Riley CreditAttribution: Christopher Riley commentedI added a "Test" token and the warning on the status report page disappears. Maybe on install there should be a sample generated.