2
// $Id: views_handler_filter_many_to_one.inc,v 1.1 2008/09/03 19:21:28 merlinofchaos Exp $
5
* Complex filter to handle filtering for many to one relationships,
6
* such as terms (many terms per node) or roles (many roles per user).
8
* The construct method needs to be overridden to provide a list of options;
9
* alternately, the value_form and admin_summary methods need to be overriden
10
* to provide something that isn't just a select list.
12
class views_handler_filter_many_to_one extends views_handler_filter_in_operator {
13
function init(&$view, &$options) {
14
parent::init($view, $options);
15
$this->helper = new views_many_to_one_helper($this);
18
function option_definition() {
19
$options = parent::option_definition();
21
$options['operator']['default'] = 'or';
22
$options['value']['default'] = array();
28
* Provide inclusive/exclusive matching
30
function operator_options() {
32
'or' => t('Is one of'),
33
'and' => t('Is all of'),
34
'not' => t('Is none of'),
38
var $value_form_type = 'select';
39
function value_form(&$form, &$form_state) {
40
parent::value_form($form, $form_state);
42
if (empty($form_state['exposed'])) {
43
$this->helper->options_form($form, $form_state);
48
* Override ensure_my_table so we can control how this joins in.
49
* The operator actually has influence over joining.
51
function ensure_my_table() {
52
$this->helper->ensure_my_table();
56
if (empty($this->value)) {
59
$this->helper->add_filter();