You are here

protected static function FilterPluginBase::arrayFilterZero in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/filter/FilterPluginBase.php \Drupal\views\Plugin\views\filter\FilterPluginBase::arrayFilterZero()

Filter by no empty values, though allow the use of (string) "0".

Parameters

string $var: The variable to evaluate.

Return value

bool TRUE if the value is equal to an empty string, FALSE otherwise.

File

core/modules/views/src/Plugin/views/filter/FilterPluginBase.php, line 1664

Class

FilterPluginBase
Base class for Views filters handler plugins.

Namespace

Drupal\views\Plugin\views\filter

Code

protected static function arrayFilterZero($var) {
  if (is_int($var)) {
    return $var != 0;
  }
  return trim($var) != '';
}