You are here

public function YaMaps::getYandexMapsFields in Yandex.Maps 8

Returns yandex maps specific field names.

Return value

array List of yandex maps fields.

1 call to YaMaps::getYandexMapsFields()
YaMaps::buildOptionsForm in src/Plugin/views/style/YaMaps.php
Provide a form to edit options for this plugin.

File

src/Plugin/views/style/YaMaps.php, line 567

Class

YaMaps
Allow to display several field items on a yandex map.

Namespace

Drupal\yamaps\Plugin\views\style

Code

public function getYandexMapsFields() {
  $field_names = [
    '' => $this
      ->t('@PLACEMARK_NONE_FIELD', [
      '@PLACEMARK_NONE_FIELD' => static::PLACEMARK_NONE_FIELD,
    ]),
  ];
  $fields = $this->displayHandler
    ->getHandlers('field');
  $field_map = \Drupal::service('entity_field.manager')
    ->getFieldMapByFieldType('yamaps');
  $yamap_fields = [];
  foreach ($field_map as $entity_type_fields) {
    foreach ($entity_type_fields as $field_id => $field_data) {
      $yamap_fields[$field_id] = $field_id;
    }
  }
  foreach ($fields as $id => $handler) {
    if (isset($yamap_fields[$id])) {
      $field_names[$id] = $handler->definition['title'];
    }
  }
  return $field_names;
}