function DateRangeItem::isEmpty

Same name in other branches
  1. 9 core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::isEmpty()
  2. 8.9.x core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::isEmpty()
  3. 11.x core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php \Drupal\datetime_range\Plugin\Field\FieldType\DateRangeItem::isEmpty()

Overrides DateTimeItem::isEmpty

File

core/modules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php, line 119

Class

DateRangeItem
Plugin implementation of the 'daterange' field type.

Namespace

Drupal\datetime_range\Plugin\Field\FieldType

Code

public function isEmpty() {
    $start_value = $this->get('value')
        ->getValue();
    $end_value = $this->get('end_value')
        ->getValue();
    return ($start_value === NULL || $start_value === '') && ($end_value === NULL || $end_value === '');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.