public function bat_event_handler_blocking_filter::query in Booking and Availability Management Tools for Drupal 7
Add this filter to the query.
Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.
Overrides views_handler_filter_boolean_operator::query
File
- modules/
bat_event/ views/ bat_event_handler_blocking_filter.inc, line 36
Class
Code
public function query() {
$this
->ensure_my_table();
if ($this->value == 'not_blocking' || $this->value == 'blocking') {
$state_reference_join = new views_join();
$state_reference_join->table = 'field_data_event_state_reference';
$state_reference_join->field = 'entity_id';
$state_reference_join->left_table = 'bat_events';
$state_reference_join->left_field = 'event_id';
$state_reference_join->type = 'left';
$this->query
->add_relationship('field_data_event_state_reference', $state_reference_join, 'bat_events');
$state_join = new views_join();
$state_join->table = 'bat_event_state';
$state_join->field = 'id';
$state_join->left_table = 'field_data_event_state_reference';
$state_join->left_field = 'event_state_reference_state_id';
$state_join->type = 'left';
$this->query
->add_relationship('bat_event_state', $state_join, 'field_data_event_state_reference');
if ($this->value == 'not_blocking') {
$this->query
->add_where(1, 'bat_event_state.blocking', '0', '=');
}
elseif ($this->value == 'blocking') {
$this->query
->add_where(1, 'bat_event_state.blocking', '1', '=');
}
}
}