1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Contains the entity_views_handler_relationship class.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Relationship handler for data selection tables.
|
10
|
*
|
11
|
* This handler may only be used in conjunction with data selection based Views
|
12
|
* tables or other base tables using a query plugin that supports data
|
13
|
* selection.
|
14
|
*
|
15
|
* @see entity_views_field_definition()
|
16
|
* @ingroup views_field_handlers
|
17
|
*/
|
18
|
class entity_views_handler_relationship extends views_handler_relationship {
|
19
|
|
20
|
/**
|
21
|
* Slightly modify the options form provided by the parent handler.
|
22
|
*/
|
23
|
public function options_form(&$form, &$form_state) {
|
24
|
parent::options_form($form, $form_state);
|
25
|
// This won't work with data selector-based relationships, as we only
|
26
|
// inspect those *after* the results are known.
|
27
|
$form['required']['#access'] = FALSE;
|
28
|
// Notify the user of our restrictions regarding lists of entities, if
|
29
|
// appropriate.
|
30
|
if (!empty($this->definition['multiple'])) {
|
31
|
$form['multiple_note'] = array(
|
32
|
'#markup' => t('<strong>Note:</strong> This is a multi-valued relationship, which is currently not supported. ' .
|
33
|
'Only the first related entity will be shown.'),
|
34
|
'#weight' => -5,
|
35
|
);
|
36
|
}
|
37
|
}
|
38
|
|
39
|
/**
|
40
|
* Called to implement a relationship in a query.
|
41
|
*
|
42
|
* As we don't add any data to the query itself, we don't have to do anything
|
43
|
* here. Views just don't thinks we have been called unless we set our
|
44
|
* $alias property. Otherwise, this override is just here to keep PHP from
|
45
|
* blowing up by calling inexistent methods on the query plugin.
|
46
|
*/
|
47
|
public function query() {
|
48
|
$this->alias = $this->options['id'];
|
49
|
}
|
50
|
|
51
|
}
|