spaces_handler_filter_spaces_current.inc in Spaces 6.2
File
includes/spaces_handler_filter_spaces_current.inc
View source
<?php
class spaces_handler_filter_spaces_current extends views_handler_filter {
function query() {
$space = spaces_get_space();
if ($space && $space->type != 'site') {
if ($this->relationship) {
$base_table = $this->view->query->relationships[$this->relationship]['table'];
}
else {
$base_table = $this->view->base_table;
}
$space
->views_filter($this->view->query, $base_table, $this->relationship);
}
else {
if ($this->options['operator'] === 'all') {
$this->view->build_info['fail'] = TRUE;
}
}
}
function operator_form(&$form, &$form_state) {
$options = $this
->operator_options();
if (!empty($options)) {
$form['operator'] = array(
'#type' => 'select',
'#title' => t('When not in a space'),
'#default_value' => $this->operator,
'#options' => $options,
'#description' => t('Helpful if you want to use this view both inside and out of spaces.'),
);
}
}
function operator_options() {
return array(
'all' => t('Hide all results'),
'active' => t('Show all results'),
);
}
}