function panels_content_cache_node_clear_cache in Panels Content Cache 7
Same name and namespace in other branches
- 6 panels_content_cache.module \panels_content_cache_node_clear_cache()
This function is called from hook_node_*() and invalidates the panel cache when a node is updated and it matches the criteria chosen in the caching of any panels.
Parameters
$node: The node object for the current node being saved.
6 calls to panels_content_cache_node_clear_cache()
- panels_content_cache_comment_clear_cache in ./
panels_content_cache.module - Clear the cache bin for this comment's content type.
- panels_content_cache_node_delete in ./
panels_content_cache.module - Implements hook_node_delete().
- panels_content_cache_node_insert in ./
panels_content_cache.module - Implements hook_node_insert().
- panels_content_cache_node_revision_delete in ./
panels_content_cache.module - Implements hook_node_revision_delete().
- panels_content_cache_node_update in ./
panels_content_cache.module - Implements hook_node_update().
File
- ./
panels_content_cache.module, line 195 - Primary hook implementations.
Code
function panels_content_cache_node_clear_cache($node) {
// Check if the $node->type is in panels_content_cache table. If it exists
// then we want to try and lookup the display ID from panels_content_cache to
// see if we need to clear the cache on any panels.
$types = variable_get('panels_content_cache_types', array());
if (!empty($types) && in_array($node->type, $types)) {
module_load_include('inc', 'panels_content_cache', 'plugins/cache/content');
$results = db_select('panels_content_cache', 'p')
->condition('p.type', $node->type, '=')
->fields('p', array(
'did',
))
->distinct()
->execute();
if (!empty($results)) {
foreach ($results as $row) {
$display = panels_load_display($row->did);
if (is_object($display)) {
panels_content_cache_clear_cache($display);
}
}
}
}
}