You are here

public function GeolocationItem::getValue in Geolocation Field 8.3

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

Gets the data value.

Return value

mixed The data value.

Overrides Map::getValue

File

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

Class

GeolocationItem
Plugin implementation of the 'geolocation' field type.

Namespace

Drupal\geolocation\Plugin\Field\FieldType

Code

public function getValue() {

  // Update the values and return them.
  foreach ($this->properties as $name => $property) {
    $value = $property
      ->getValue();

    // Only write NULL values if the whole map is not NULL.
    if (isset($this->values) || isset($value)) {
      $this->values[$name] = $value;
    }
  }

  // See #3024504 for an explanation.
  if (array_key_exists('data', $this->values) && empty($this->values['data'])) {
    unset($this->values['data']);
  }
  return $this->values;
}