You are here

function FieldPluginBase::is_value_empty in Views (for Drupal 7) 8.3

Checks if a field value is empty.

Parameters

$value: The field value.

bool $empty_zero: Whether or not this field is configured to consider 0 as empty.

bool $no_skip_empty: Whether or not to use empty() to check the value.

Return value

bool TRUE if the value is considered empty, FALSE otherwise.

2 calls to FieldPluginBase::is_value_empty()
FieldPluginBase::advanced_render in lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
Render a field using advanced settings.
FieldPluginBase::render_text in lib/Drupal/views/Plugin/views/field/FieldPluginBase.php
Perform an advanced text render for the item.

File

lib/Drupal/views/Plugin/views/field/FieldPluginBase.php, line 1182
Definition of Drupal\views\Plugin\views\field\FieldPluginBase.

Class

FieldPluginBase
Base field handler that has no options and renders an unformatted field.

Namespace

Drupal\views\Plugin\views\field

Code

function is_value_empty($value, $empty_zero, $no_skip_empty = TRUE) {
  if (!isset($value)) {
    $empty = TRUE;
  }
  else {
    $empty = $empty_zero || $value !== 0 && $value !== '0';
  }
  if ($no_skip_empty) {
    $empty = empty($value) && $empty;
  }
  return $empty;
}