You are here

function geolocation_yandex_library_info_build in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_yandex/geolocation_yandex.module \geolocation_yandex_library_info_build()

Implements hook_library_info_build().

File

modules/geolocation_yandex/geolocation_yandex.module, line 11
Yandex Maps hooks.

Code

function geolocation_yandex_library_info_build() {
  $config = \Drupal::config('yandex_maps.settings');
  $api_key = $config
    ->get('key');
  $lang = \Drupal::languageManager()
    ->getCurrentLanguage();
  $libraries = [];
  $libraries['yandex_maps'] = [
    'version' => '1.x',
    'js' => [
      'https://api-maps.yandex.ru/2.1/?apikey=' . $api_key . '&lang=' . $lang
        ->getId() => [
        'type' => 'external',
      ],
    ],
  ];
  return $libraries;
}