You are here

public function TimeRangeType::isEmpty in Time Field For Drupal 8.x / 9.x 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/Field/FieldType/TimeRangeType.php \Drupal\time_field\Plugin\Field\FieldType\TimeRangeType::isEmpty()

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/TimeRangeType.php, line 70

Class

TimeRangeType
Plugin implementation of the 'time' field type.

Namespace

Drupal\time_field\Plugin\Field\FieldType

Code

public function isEmpty() {
  $from = $this
    ->get('from')
    ->getValue();
  $to = $this
    ->get('to')
    ->getValue();
  return trim($from) === '' || trim($to) === '';
}