You are here

function _filter_harmonizer_is_empty in Views Filter Harmonizer 7

Determines whether the supplied array is considered "empty".

This function considers as empty any array with at least one empty entry.

Parameters

array $array: May be a mix of simple values and nested arrays.

Return value

bool TRUE if empty, FALSE otherwise.

1 call to _filter_harmonizer_is_empty()
filter_harmonizer_filter_is_empty in ./filter_harmonizer.module
Determine whether the supplied argument constitutes an empty filter.

File

./filter_harmonizer.module, line 678
filter_harmonizer.module For Views where both exposed and contextual filters are active on a page.

Code

function _filter_harmonizer_is_empty($array) {
  foreach ($array as $value) {
    if (empty($value) && $value !== 0) {
      return TRUE;
    }
    if (is_array($value)) {
      return _filter_harmonizer_is_empty($value);
    }
  }
  $filtered = array_filter($array);

  // For multi-selects: consider these empty when all options are deselected.
  return count($array) > 1 ? empty($filtered) : empty($array);
}