You are here

private function GeocoderFieldPluginManager::getFieldsOptions in Geocoder 8.3

Same name and namespace in other branches
  1. 8.2 modules/geocoder_field/src/GeocoderFieldPluginManager.php \Drupal\geocoder_field\GeocoderFieldPluginManager::getFieldsOptions()

Get Fields Options.

Parameters

string $entity_type_id: The entity type id.

string $bundle: The bundle.

string $field_name: The field name.

array $field_types: The field types array.

Return value

mixed The options results.

2 calls to GeocoderFieldPluginManager::getFieldsOptions()
GeocoderFieldPluginManager::getGeocodeSourceFields in modules/geocoder_field/src/GeocoderFieldPluginManager.php
Gets a list of fields available as source for Geocode operations.
GeocoderFieldPluginManager::getReverseGeocodeSourceFields in modules/geocoder_field/src/GeocoderFieldPluginManager.php
Gets a list of fields available as source for Reverse Geocode operations.

File

modules/geocoder_field/src/GeocoderFieldPluginManager.php, line 78

Class

GeocoderFieldPluginManager
The Geocoder Field Plugin manager.

Namespace

Drupal\geocoder_field

Code

private function getFieldsOptions($entity_type_id, $bundle, $field_name, array $field_types) {
  $options = [];
  foreach ($this->entityFieldManager
    ->getFieldDefinitions($entity_type_id, $bundle) as $id => $definition) {
    if (in_array($definition
      ->getType(), $field_types) && $definition
      ->getName() !== $field_name && !in_array($id, [
      'title',
      'revision_log',
    ])) {
      $options[$id] = new TranslatableMarkup('@label (@name) [@type]', [
        '@label' => $definition
          ->getLabel(),
        '@name' => $definition
          ->getName(),
        '@type' => $definition
          ->getType(),
      ]);
    }
  }
  return $options;
}