You are here

function yamaps_library in Yandex.Maps 7

Implements hook_library().

File

./yamaps.module, line 91
Yandex Maps module main file.

Code

function yamaps_library() {

  // Users language.
  global $language;

  // Module path.
  $path = drupal_get_path('module', 'yamaps') . '/misc/';

  // Weight counter.
  $w = 10;

  // API url.
  $api_url = url(YAMAPS_API_URL, [
    'absolute' => TRUE,
    'query' => [
      'load' => 'package.full',
      'lang' => YAMAPS_API_LANGUAGE,
      'wizard' => 'Drupal_yamaps_' . $language->language,
      'apikey' => variable_get('yamaps_api_key', ''),
    ],
  ]);
  $libraries['yamaps.full'] = [
    'title' => 'Yandex maps. Version for dynamic map.',
    'version' => '2.x',
    'js' => [
      $api_url => [
        'type' => 'external',
        'scope' => 'header',
        'weight' => $w++,
      ],
      $path . 'yamaps.init.js' => [
        'scope' => 'footer',
        'weight' => $w++,
      ],
      $path . 'yamaps.layouts.js' => [
        'scope' => 'footer',
        'weight' => $w++,
      ],
      $path . 'yamaps.placemark.js' => [
        'scope' => 'footer',
        'weight' => $w++,
      ],
      $path . 'yamaps.line.js' => [
        'scope' => 'footer',
        'weight' => $w++,
      ],
      $path . 'yamaps.polygon.js' => [
        'scope' => 'footer',
        'weight' => $w++,
      ],
      $path . 'yamaps.route.js' => [
        'scope' => 'footer',
        'weight' => $w++,
      ],
      $path . 'yamaps.maps.js' => [
        'scope' => 'footer',
        'weight' => $w++,
      ],
      $path . 'yamaps.run.js' => [
        'scope' => 'footer',
        'weight' => $w++,
      ],
    ],
    'css' => [
      $path . 'yamaps.css' => [],
    ],
  ];
  return $libraries;
}