You are here

private function IpGeoLocPluginStyleLeaflet::getZoomTitles in IP Geolocation Views & Maps 8

Peding doc.

1 call to IpGeoLocPluginStyleLeaflet::getZoomTitles()
IpGeoLocPluginStyleLeaflet::addClusterDifferentiator in src/Plugin/views/style/IpGeoLocPluginStyleLeaflet.php
Form part definition.

File

src/Plugin/views/style/IpGeoLocPluginStyleLeaflet.php, line 1143

Class

IpGeoLocPluginStyleLeaflet
Views Style plugin extension for Leaflet (if enabled).

Namespace

Drupal\ip_geoloc\Plugin\views\style

Code

private function getZoomTitles($field_type, $label, $region_depth) {
  $titles = [];
  if ($field_type === 'addressfield') {
    $titles[] = $this
      ->t('Zoom range for country');
    $titles[] = $this
      ->t('Zoom range for administrative area (state, district, county)');
    $titles[] = $this
      ->t('Zoom range for locality (city, town, village)');
    $titles[] = $this
      ->t('Zoom range for post code (ZIP)');
    return $titles;
  }
  $pos_colon = strrpos($label, ':');
  $label = Unicode::substr($label, $pos_colon > 0 ? $pos_colon + 1 : 0);
  if ($field_type === 'taxonomy_term_reference') {
    for ($level = 1; $level <= $region_depth; $level++) {
      $titles[] = $this
        ->t('Zoom range for %field level @level', [
        '%field' => $label,
        '@level' => $level,
      ]);
    }
  }
  else {
    $titles[] = $this
      ->t('Zoom range for %field', [
      '%field' => $label,
    ]);
  }
  return $titles;
}