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.
Upgrade to 3.11 caused all views to disappear from one of our sites.
After some debugging we found that one of our custom modules in hook_views_data() calls field_info_extra_fields().
We also use eva module, which calls eva_get_views() in eva_field_extra_fields(). This causes _views_fetch_plugin_data() to be called recursively at the point then the static variable $cache is already set but is still empty. As a result this empty cache is returned, causing part of views data to be empty.
Attached patch fixes the issue.
Comment | File | Size | Author |
---|---|---|---|
views.fix_empty_cache.patch | 517 bytes | tatyana | |
Comments
Comment #2
matthiasm11 CreditAttribution: matthiasm11 at Randstad Digital commentedI can confirm the patch works. Thanks!
Comment #3
colanWe've recently switched our testing from the old qa.drupal.org to DrupalCI. Because of a bug in the new system, #2623840: Views (D7) patches not being tested, older patches must be re-uploaded. On re-uploading the patch, please set the status to "Needs Review" so that the test bot will add it to its queue.
If all tests pass, change the Status back to "Reviewed & tested by the community". We'll most likely commit the patch immediately without having to go through another round of peer review.
We apologize for the trouble, and appreciate your patience.
Comment #4
matthiasm11 CreditAttribution: matthiasm11 at Randstad Digital commentedUse this patch with caution. It broke some of our views (in combination with search api).
Our problem
The implemented mymoduly_field_info_extra_fields() was called during the building of cache. This hook contained an entity_load, which tried to rebuild the cache too, but $cache was still FALSE in _views_fetch_plugin_data(). => Recursive building of the cache.
Our solution
We replaced the entity_load in mymoduly_field_info_extra_fields() with a custom db_select(), so the caching part is skipped. Since hook_field_info_extra_fields() is only called after a cache clear, the performance should stay the same. Or even better because we do not load the whole entity, but just one field.
Comment #5
matthiasm11 CreditAttribution: matthiasm11 at Randstad Digital commented