1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Provides info about statistics.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_entity_property_info_alter() on top of statistics module.
|
10
|
*
|
11
|
* @see entity_entity_property_info_alter()
|
12
|
*/
|
13
|
function entity_metadata_statistics_entity_property_info_alter(&$info) {
|
14
|
$properties = &$info['node']['properties'];
|
15
|
|
16
|
$properties['views'] = array(
|
17
|
'label' => t("Number of views"),
|
18
|
'description' => t("The number of visitors who have read the node."),
|
19
|
'type' => 'integer',
|
20
|
'getter callback' => 'entity_metadata_statistics_node_get_properties',
|
21
|
'computed' => TRUE,
|
22
|
'access callback' => 'entity_metadata_statistics_properties_access',
|
23
|
);
|
24
|
$properties['day_views'] = array(
|
25
|
'label' => t("Views today"),
|
26
|
'description' => t("The number of visitors who have read the node today."),
|
27
|
'type' => 'integer',
|
28
|
'getter callback' => 'entity_metadata_statistics_node_get_properties',
|
29
|
'computed' => TRUE,
|
30
|
'access callback' => 'entity_metadata_statistics_properties_access',
|
31
|
);
|
32
|
$properties['last_view'] = array(
|
33
|
'label' => t("Last view"),
|
34
|
'description' => t("The date on which a visitor last read the node."),
|
35
|
'type' => 'date',
|
36
|
'getter callback' => 'entity_metadata_statistics_node_get_properties',
|
37
|
'computed' => TRUE,
|
38
|
'access callback' => 'entity_metadata_statistics_properties_access',
|
39
|
);
|
40
|
}
|