You are here

public function OptionalEndDateDateRangeItem::isEmpty in Optional End Date 8

Determines whether the data structure is empty.

Return value

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

Overrides DateRangeItem::isEmpty

File

src/Plugin/Field/FieldType/OptionalEndDateDateRangeItem.php, line 35

Class

OptionalEndDateDateRangeItem
Custom DateRangeItem for optional end_value.

Namespace

Drupal\optional_end_date\Plugin\Field\FieldType

Code

public function isEmpty() {
  if ($this
    ->getFieldDefinition()
    ->getFieldStorageDefinition()
    ->getSetting('optional_end_date')) {
    $start_value = $this
      ->get('value')
      ->getValue();
    return $start_value === NULL || $start_value === '';
  }
  return parent::isEmpty();
}