Commit | Line | Data |
---|---|---|
7f254ad8 AE |
1 | <?php |
2 | ||
3 | /** | |
4 | * @file | |
5 | * Contains the entity_views_handler_field_date class. | |
6 | */ | |
7 | ||
8 | /** | |
9 | * A handler to provide proper displays for dates. | |
10 | * | |
11 | * Overrides the default Views handler to retrieve the data from an entity via | |
12 | * data selection. | |
13 | * | |
14 | * This handler may only be used in conjunction with data selection based Views | |
15 | * tables or other base tables using a query plugin that supports data | |
16 | * selection. | |
17 | * | |
18 | * @see entity_views_field_definition() | |
19 | * @ingroup views_field_handlers | |
20 | */ | |
21 | class entity_views_handler_field_date extends views_handler_field_date { | |
22 | ||
23 | /** | |
24 | * Stores the entity type of the result entities. | |
25 | */ | |
26 | public $entity_type; | |
27 | ||
28 | /** | |
29 | * Stores the result entities' metadata wrappers. | |
30 | */ | |
31 | public $wrappers = array(); | |
32 | ||
33 | /** | |
34 | * Stores the current value when rendering list fields. | |
35 | */ | |
36 | public $current_value; | |
37 | ||
38 | /** | |
39 | * Overridden to add the field for the entity ID (if necessary). | |
40 | */ | |
41 | public function query() { | |
42 | EntityFieldHandlerHelper::query($this); | |
43 | } | |
44 | ||
45 | /** | |
46 | * Adds a click-sort to the query. | |
47 | */ | |
48 | public function click_sort($order) { | |
49 | EntityFieldHandlerHelper::click_sort($this, $order); | |
50 | } | |
51 | ||
52 | /** | |
53 | * Load the entities for all rows that are about to be displayed. | |
54 | */ | |
55 | public function pre_render(&$values) { | |
56 | parent::pre_render($values); | |
57 | EntityFieldHandlerHelper::pre_render($this, $values); | |
58 | } | |
59 | ||
60 | /** | |
61 | * Overridden to use a metadata wrapper. | |
62 | */ | |
63 | public function get_value($values, $field = NULL) { | |
64 | return EntityFieldHandlerHelper::get_value($this, $values, $field); | |
65 | } | |
66 | ||
67 | /** | |
68 | * Provide options for this handler. | |
69 | */ | |
70 | public function option_definition() { | |
71 | return parent::option_definition() + EntityFieldHandlerHelper::option_definition($this); | |
72 | } | |
73 | ||
74 | /** | |
75 | * Provide a options form for this handler. | |
76 | */ | |
77 | public function options_form(&$form, &$form_state) { | |
78 | parent::options_form($form, $form_state); | |
79 | EntityFieldHandlerHelper::options_form($this, $form, $form_state); | |
80 | } | |
81 | ||
82 | /** | |
83 | * Render the field. | |
84 | * | |
85 | * @param $values | |
86 | * The values retrieved from the database. | |
87 | */ | |
88 | public function render($values) { | |
89 | return EntityFieldHandlerHelper::render($this, $values); | |
90 | } | |
91 | ||
92 | /** | |
93 | * Render a single field value. | |
94 | */ | |
95 | public function render_single_value($value, $values) { | |
96 | return parent::render($values); | |
97 | } | |
98 | ||
99 | } |