You are here

protected function AssetGeometryItemList::computeValue in farmOS 2.x

Computes the current geometry value for the asset.

Overrides ComputedItemListTrait::computeValue

File

modules/core/location/src/Field/AssetGeometryItemList.php, line 18

Class

AssetGeometryItemList
Computes the current geometry value for assets.

Namespace

Drupal\farm_location\Field

Code

protected function computeValue() {

  // Get the asset entity.
  $entity = $this
    ->getEntity();

  // Get the asset geometry.
  $geometry = \Drupal::service('asset.location')
    ->getGeometry($entity);

  // Update the assets current geometry value to match.
  // @todo Cache this field computation.
  $this->list[0] = $this
    ->createItem(0, $geometry);
}