Commit 96861e44 authored by fago's avatar fago

#1162210 patch by fangel: fixed statistics modules' entity properties.

parent 4c52717c
......@@ -46,7 +46,7 @@ function entity_entity_property_info_alter(&$entity_info) {
}
function _entity_metadata_core_modules() {
return array_filter(array('book', 'comment', 'field', 'node', 'taxonomy', 'user', 'system'), 'module_exists');
return array_filter(array('book', 'comment', 'field', 'node', 'taxonomy', 'user', 'system', 'statistics'), 'module_exists');
}
/**
......
......@@ -173,14 +173,15 @@ function entity_metadata_poll_node_get_properties($node, array $options, $name)
* @see entity_metadata_statistics_entity_info_alter()
*/
function entity_metadata_statistics_node_get_properties($node, array $options, $name) {
$statistics = statistics_get($node->nid);
$statistics = (array) statistics_get($node->nid);
$statistics += array('totalcount' => 0, 'daycount' => 0, 'timestamp' => NULL);
switch ($name) {
case 'views':
return $statistics['totalviews'];
return $statistics['totalcount'];
case 'day_views':
return $statistics['dayviews'];
return $statistics['daycount'];
case 'last_view':
return $statistics['timestamp'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment