votingapi.inc in Views content cache 6.2
File
plugins/votingapi.inc
View source
<?php
class views_content_cache_key_votingapi extends views_content_cache_key {
function options_form($value) {
$metadata = votingapi_metadata();
$options = array();
foreach ($metadata['tags'] as $tag => $data) {
$options['tag:' . $tag] = t('Tag: @name', array(
'@name' => $data['name'],
));
}
foreach ($metadata['functions'] as $function => $data) {
$options['function:' . $function] = t('Function: @name', array(
'@name' => $data['name'],
));
}
return array(
'#title' => t('Voting API'),
'#description' => t('Checks for updates to votes'),
'#type' => 'checkboxes',
'#options' => $options,
'#default_value' => $value,
);
}
function content_key($object, $object_type) {
$keys = array();
if ($object_type === 'votingapi_results') {
foreach ($object as $result) {
$keys[] = 'tag:' . $result['tag'];
$keys[] = 'function:' . $result['function'];
}
}
return $keys;
}
function clause_mode() {
return 'OR';
}
}