You are here

function imagefield_views_handler_filter_is_not_null in ImageField 5.2

Custom filter for imagefield NOT null.

1 string reference to 'imagefield_views_handler_filter_is_not_null'
imagefield_field_settings in ./imagefield.module
Implementation of hook_field_settings().

File

./imagefield.module, line 190
Defines an image field type. imagefield uses content.module to store the fid, and the drupal files table to store the actual file data.

Code

function imagefield_views_handler_filter_is_not_null($op, $filter, $filterinfo, &$query) {
  if ($op == 'handler') {
    $query
      ->ensure_table($filterinfo['table']);
    if ($filter['value']) {
      $qs = '%s.%s > 0';
      $query
        ->add_where($qs, $filterinfo['table'], $filterinfo['field']);
    }
    else {
      $qs = '%s.%s = 0 OR %s.%s IS null';
      $query
        ->add_where($qs, $filterinfo['table'], $filterinfo['field'], $filterinfo['table'], $filterinfo['field']);
    }
  }
}