You are here

function finder_wheres in Finder 6

Same name and namespace in other branches
  1. 7 finder.module \finder_wheres()
1 call to finder_wheres()
finder_query in ./finder.module

File

./finder.module, line 1199
The finder module.

Code

function finder_wheres($wheres) {
  $operator = isset($wheres['#operator']) ? $wheres['#operator'] : 'AND';
  unset($wheres['#operator']);
  foreach ($wheres as $key => $where) {
    if (is_array($where)) {
      $finder_wheres = finder_wheres($where);
      if ($finder_wheres) {
        $wheres[$key] = '(' . $finder_wheres . ')';
      }
      else {
        unset($wheres[$key]);
      }
    }
  }
  return implode(' ' . $operator . ' ', $wheres);
}