You are here

public function vms_handler_filter_mlid::query in Views Menu Support 7

Same name and namespace in other branches
  1. 8 handlers/vms_handler_filter_mlid.inc \vms_handler_filter_mlid::query()

Add the filtering to the query.

Potentially redundant if the parent class could be replaced with an IN handler.

Overrides views_handler_filter::query

File

handlers/vms_handler_filter_mlid.inc, line 56
Filter handler for allowing restricting integer fields based on currently active menu items (plus trails).

Class

vms_handler_filter_mlid
Filter to compare a field against currently active menu link item.

Code

public function query() {
  $this
    ->ensure_my_table();
  $vms_target = vms_get_current_mlid($this->options['value']);
  $table = $this->table_alias . '.' . $this->real_field;
  if ($this->operator == '=') {
    $this->query
      ->add_where($this->options['group'], $table, $vms_target, 'IN');
  }
  else {
    $this->query
      ->add_where($this->options['group'], db_or()
      ->condition($table, $vms_target, 'NOT IN')
      ->condition($table, $vms_target, 'IS NULL'));
  }
}