1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Provides info about poll nodes.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_entity_property_info_alter() on top of poll module.
|
10
|
*
|
11
|
* @see entity_entity_property_info_alter()
|
12
|
*/
|
13
|
function entity_metadata_poll_entity_property_info_alter(&$info) {
|
14
|
$properties = &$info['node']['bundles']['poll']['properties'];
|
15
|
|
16
|
$properties['poll_votes'] = array(
|
17
|
'label' => t("Poll votes"),
|
18
|
'description' => t("The number of votes that have been cast on a poll node."),
|
19
|
'type' => 'integer',
|
20
|
'getter callback' => 'entity_metadata_poll_node_get_properties',
|
21
|
'computed' => TRUE,
|
22
|
);
|
23
|
$properties['poll_winner'] = array(
|
24
|
'label' => t("Poll winner"),
|
25
|
'description' => t("The winning poll answer."),
|
26
|
'getter callback' => 'entity_metadata_poll_node_get_properties',
|
27
|
'sanitize' => 'filter_xss',
|
28
|
'computed' => TRUE,
|
29
|
);
|
30
|
$properties['poll_winner_votes'] = array(
|
31
|
'label' => t("Poll winner votes"),
|
32
|
'description' => t("The number of votes received by the winning poll answer."),
|
33
|
'type' => 'integer',
|
34
|
'getter callback' => 'entity_metadata_poll_node_get_properties',
|
35
|
'computed' => TRUE,
|
36
|
);
|
37
|
$properties['poll_winner_percent'] = array(
|
38
|
'label' => t("Poll winner percent"),
|
39
|
'description' => t("The percentage of votes received by the winning poll answer."),
|
40
|
'getter callback' => 'entity_metadata_poll_node_get_properties',
|
41
|
'type' => 'decimal',
|
42
|
'computed' => TRUE,
|
43
|
);
|
44
|
$properties['poll_duration'] = array(
|
45
|
'label' => t("Poll duration"),
|
46
|
'description' => t("The length of time the poll node is set to run."),
|
47
|
'getter callback' => 'entity_metadata_poll_node_get_properties',
|
48
|
'type' => 'duration',
|
49
|
);
|
50
|
}
|