function render_cache_entity_info_alter in Render cache 7
Implements hook_entity_info_alter().
We hijack entity rendering, as performed through the Entity API module, to provide full entity caching.
Parameters
array $entity_info:
File
- ./
render_cache.module, line 234 - Hook implementations and frequently used functions for render cache module.
Code
function render_cache_entity_info_alter(&$entity_info) {
foreach ($entity_info as $type => $info) {
if (isset($info['view callback'])) {
// Since we are overwriting the view callback we record the original
// callback so that we know how to render.
$entity_info[$type]['render cache']['callback'] = $info['view callback'];
/* @see render_cache_entity_view_callback() */
$entity_info[$type]['view callback'] = 'render_cache_entity_view_callback';
}
elseif (isset($info['controller class']) && in_array('EntityAPIControllerInterface', class_implements($info['controller class']))) {
// We do not set the render cache callback, when it is missing we will
// render using the controller class.
/* @see render_cache_entity_view_callback() */
$entity_info[$type]['view callback'] = 'render_cache_entity_view_callback';
}
}
}