You are here

public function Geofield::isViewsGeoOption in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_geofield/src/Plugin/geolocation/DataProvider/Geofield.php \Drupal\geolocation_geofield\Plugin\geolocation\DataProvider\Geofield::isViewsGeoOption()

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_geofield/src/Plugin/geolocation/DataProvider/Geofield.php, line 27

Class

Geofield
Provides Google Maps.

Namespace

Drupal\geolocation_geofield\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 ($field_storage_definition
        ->getType() == 'geofield') {
        return TRUE;
      }
    }
  }
  return FALSE;
}