function panels_content_cache_variable_set in Panels Content Cache 6
Helper function to set a variable to store the list of content_types (types) in panels_content_cache table and the list of menu_names.
These variables are used to save queries against the table in other hooks
Parameters
$name: The name of the variable to set.
See also
panels_content_cache_nodeapi()
panels_content_cache_menu_link_alter()
1 call to panels_content_cache_variable_set()
- panels_content_cache_panels_display_save in ./
panels_content_cache.module - Implements hook_panels_display_save().
File
- ./
panels_content_cache.module, line 74
Code
function panels_content_cache_variable_set($name = 'types') {
$fields = array(
'menu_names' => 'menu_name',
'types' => 'type',
);
$field = isset($fields[$name]) ? $fields[$name] : NULL;
// Check if we have a valid field to retrieve.
if (!empty($field)) {
$values = array();
$sql = "SELECT DISTINCT {$field} FROM {panels_content_cache} WHERE {$field} IS NOT NULL";
$result = db_query($sql);
while ($value = db_fetch_object($result)) {
$values[] = $value->{$field};
}
variable_set("panels_content_cache_{$name}", $values);
}
}