You are here

function views_handler_filter_schema_type::op_simple in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 views/views_handler_filter_schema_type.inc \views_handler_filter_schema_type::op_simple()

Overrides views_handler_filter_in_operator::op_simple

File

views/views_handler_filter_schema_type.inc, line 21
Filter by the file schema type.

Class

views_handler_filter_schema_type
@file Filter by the file schema type.

Code

function op_simple() {
  if (empty($this->value)) {
    return;
  }
  $this
    ->ensure_my_table();

  // We use array_values() because the checkboxes keep keys and that can cause
  // array addition problems.
  $statements = array();
  $not_in = $this->operator == 'not in' ? TRUE : FALSE;
  $schema_operator = $not_in ? 'NOT LIKE' : 'LIKE';
  $composite = $not_in ? ' AND ' : ' OR ';
  foreach ($this->value as $schema) {
    $statements[] = 'uri ' . $schema_operator . ' \'' . db_like($schema) . '://%\'';
  }
  $this->query
    ->add_where_expression($this->options['group'], implode($composite, $statements));
}