You are here

public function SerialItem::isEmpty in Serial Field 8

Determines whether the data structure is empty.

Return value

bool TRUE if the data structure is empty, FALSE otherwise.

Overrides Map::isEmpty

File

src/Plugin/Field/FieldType/SerialItem.php, line 169

Class

SerialItem
Plugin implementation of the 'serial' field type.

Namespace

Drupal\serial\Plugin\Field\FieldType

Code

public function isEmpty() {
  $value = $this
    ->get('value')
    ->getValue();

  // For numbers, the field is empty if the value isn't numeric.
  // But should never be treated as empty.
  $empty = $value === NULL || !is_numeric($value);
  return $empty;
}