You are here

public function GeolocationItem::isEmpty in Geolocation Field 8.2

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 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

2 calls to GeolocationItem::isEmpty()
GeolocationItem::onChange in src/Plugin/Field/FieldType/GeolocationItem.php
React to changes to a child property or item.
GeolocationItem::setValue in src/Plugin/Field/FieldType/GeolocationItem.php
Sets the data value.

File

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

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 === '';
}