Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/handlers/views_handler_filter_entity_bundle.inc | ||
---|---|---|
2 | 2 |
|
3 | 3 |
/** |
4 | 4 |
* @file |
5 |
* Definition of views_handler_filter_entity_bundle |
|
5 |
* Definition of views_handler_filter_entity_bundle.
|
|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
... | ... | |
13 | 13 |
* @ingroup views_filter_handlers |
14 | 14 |
*/ |
15 | 15 |
class views_handler_filter_entity_bundle extends views_handler_filter_in_operator { |
16 |
|
|
16 | 17 |
/** |
17 | 18 |
* Stores the entity type on which the filter filters. |
18 | 19 |
* |
... | ... | |
20 | 21 |
*/ |
21 | 22 |
public $entity_type; |
22 | 23 |
|
23 |
function init(&$view, &$options) { |
|
24 |
/** |
|
25 |
* {@inheritdoc} |
|
26 |
*/ |
|
27 |
public function init(&$view, &$options) { |
|
24 | 28 |
parent::init($view, $options); |
25 | 29 |
|
26 | 30 |
$this->get_entity_type(); |
... | ... | |
32 | 36 |
* @return string |
33 | 37 |
* The entity type on the filter. |
34 | 38 |
*/ |
35 |
function get_entity_type() { |
|
39 |
public function get_entity_type() {
|
|
36 | 40 |
if (!isset($this->entity_type)) { |
37 | 41 |
$data = views_fetch_data($this->table); |
38 | 42 |
if (isset($data['table']['entity type'])) { |
39 | 43 |
$this->entity_type = $data['table']['entity type']; |
40 | 44 |
} |
41 | 45 |
|
42 |
// If the current filter is under a relationship you can't be sure that the |
|
43 |
// entity type of the view is the entity type of the current filter |
|
44 |
// For example a filter from a node author on a node view does have users as entity type. |
|
46 |
// If the current filter is under a relationship you can't be sure that |
|
47 |
// the entity type of the view is the entity type of the current filter |
|
48 |
// For example a filter from a node author on a node view does have users |
|
49 |
// as entity type. |
|
45 | 50 |
if (!empty($this->options['relationship']) && $this->options['relationship'] != 'none') { |
46 | 51 |
$relationships = $this->view->display_handler->get_option('relationships'); |
47 | 52 |
if (!empty($relationships[$this->options['relationship']])) { |
... | ... | |
55 | 60 |
return $this->entity_type; |
56 | 61 |
} |
57 | 62 |
|
58 |
|
|
59 |
function get_value_options() { |
|
63 |
/** |
|
64 |
* {@inheritdoc} |
|
65 |
*/ |
|
66 |
public function get_value_options() { |
|
60 | 67 |
if (!isset($this->value_options)) { |
61 | 68 |
$info = entity_get_info($this->entity_type); |
62 | 69 |
$types = $info['bundles']; |
... | ... | |
76 | 83 |
* bundle, though these two need an additional join to node/vocab table |
77 | 84 |
* to work as required. |
78 | 85 |
*/ |
79 |
function query() { |
|
86 |
public function query() {
|
|
80 | 87 |
$this->ensure_my_table(); |
81 | 88 |
|
82 | 89 |
// Adjust the join for the comment case. |
... | ... | |
119 | 126 |
} |
120 | 127 |
parent::query(); |
121 | 128 |
} |
129 |
|
|
122 | 130 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules