0

Problem

I'm trying to pull data from the entity objects on a views page that is rendered using Search API. I'm trying to pull the data from hook_views_post_render.

Views appears to sometimes load the entire entity in the path:

$view->result[x]->_entity_properties['entity object']

However it doesn't always. Sometimes the objects are just missing and I can't pull data from them. (They appear on flushing the cache and then disappear a couple normal browser refreshes after.)

Does anyone know why this happens? I was wondering if they were cached, but they don't appear in $cache or $view i.e.:

hook_views_post_render ($view, $output, $cache)

1 Answer 1

0

This is because I have search specific caching enabled on the view. This is a Search API caching plugin for views which caches both the results of a query and the HTML (I think).

So when a query is repeated it returns the HTML and doesn't load the entity objects. Because that's the entire point of the cache! (In fact it skips the entire view generation, i.e. both hooks like module_views_post_render and theme_preprocess_views_view)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.