1

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node 'token type' is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only 'node' entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).

  • Have you tried to run cron, and then clear the cache? Other suggestions say that updating token and running drush rr after that works. – Jdrupal Jul 4 at 9:58
  • I wish this would never happen again, so need to find the root cause. – quotesBro Jul 5 at 9:38
  • What version of token module are you using? And core version? – Jdrupal Jul 5 at 9:39
  • The latest stable versions of core and contrib modules. Token 7.x-1.7. And Entity API 7.x-1.9, which includes entity_token – quotesBro Jul 5 at 9:40
  • 1
    It's hard to tell what the problem is but I think its a known bug, there's a huge thread on Drupal.org about this issue, drupal.org/project/token/issues/1265848#comment-11424803 – Jdrupal Jul 5 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.