You are here

geolocation_yandex.module in Geolocation Field 8.2

Same filename and directory in other branches
  1. 8.3 modules/geolocation_yandex/geolocation_yandex.module

Yandex Maps hooks.

File

modules/geolocation_yandex/geolocation_yandex.module
View source
<?php

/**
 * @file
 * Yandex Maps hooks.
 */

/**
 * Implements hook_library_info_build().
 */
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;
}