You are here

public function GeolocationGeometry::isViewsGeoOption in Geolocation Field 8.3

Determine valid views option.

Parameters

\Drupal\views\Plugin\views\field\FieldPluginBase $views_field: Views field definition.

Return value

bool Yes or no.

Overrides DataProviderBase::isViewsGeoOption

File

modules/geolocation_geometry/src/Plugin/geolocation/DataProvider/GeolocationGeometry.php, line 46

Class

GeolocationGeometry
Provides GPX.

Namespace

Drupal\geolocation_geometry\Plugin\geolocation\DataProvider

Code

public function isViewsGeoOption(FieldPluginBase $views_field) {
  if ($views_field instanceof EntityField && $views_field
    ->getPluginId() == 'field') {
    $field_storage_definitions = $this->entityFieldManager
      ->getFieldStorageDefinitions($views_field
      ->getEntityType());
    if (!empty($field_storage_definitions[$views_field->field])) {
      $field_storage_definition = $field_storage_definitions[$views_field->field];
      if (in_array($field_storage_definition
        ->getType(), [
        'geolocation_geometry_geometry',
        'geolocation_geometry_geometrycollection',
        'geolocation_geometry_point',
        'geolocation_geometry_linestring',
        'geolocation_geometry_polygon',
        'geolocation_geometry_multipoint',
        'geolocation_geometry_multilinestring',
        'geolocation_geometry_multipolygon',
      ])) {
        return TRUE;
      }
    }
  }
  return FALSE;
}