#StackBounty: #7 #entities #nodes #tokens After saving entity bundle, entity_get_info('node') missing 'token type' prop…

Bounty: 50

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


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.