You are here

public function GeolocationItem::isEmpty in Geolocation Field 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Field/FieldType/GeolocationItem.php \Drupal\geolocation\Plugin\Field\FieldType\GeolocationItem::isEmpty()
  2. 8.2 src/Plugin/Field/FieldType/GeolocationItem.php \Drupal\geolocation\Plugin\Field\FieldType\GeolocationItem::isEmpty()

Determines whether the data structure is empty.

Return value

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

Overrides Map::isEmpty

1 call to GeolocationItem::isEmpty()
GeolocationItem::setValue in src/Plugin/Field/FieldType/GeolocationItem.php
Sets the data value.

File

src/Plugin/Field/FieldType/GeolocationItem.php, line 115

Class

GeolocationItem
Plugin implementation of the 'geolocation' field type.

Namespace

Drupal\geolocation\Plugin\Field\FieldType

Code

public function isEmpty() {
  $lat = $this
    ->get('lat')
    ->getValue();
  $lng = $this
    ->get('lng')
    ->getValue();
  return $lat === NULL || $lat === '' || $lng === NULL || $lng === '';
}