You are here

function leaflet_libraries_info in Leaflet 7

Implements hook_libraries_info().

File

./leaflet.module, line 49

Code

function leaflet_libraries_info() {
  $libraries['leaflet'] = array(
    // Only used in administrative UI of Libraries API.
    'name' => 'Leaflet JavaScript Library',
    'vendor url' => 'http://leafletjs.com/',
    'download url' => 'http://cdn.leafletjs.com/leaflet/v1.0.2/leaflet.zip',
    'version arguments' => array(
      'file' => 'leaflet.js',
      // Handle patterns like  version: "1.0.2+4bbb16c"
      'pattern' => '/version[=: ]*[\'"]([\\d+\\.]+[\\-a-z\\.\\d]*)[\'"]/',
    ),
    'files' => array(
      'js' => array(
        // This setting is needed in order to properly render market images.
        'leaflet_root_url' => array(
          'type' => 'inline',
          'data' => 'L_ROOT_URL = "' . base_path() . libraries_get_path('leaflet') . '/";',
          'group' => JS_LIBRARY,
        ),
        'leaflet.js' => array(
          'type' => 'file',
          'group' => JS_LIBRARY,
        ),
        // For AdvAgg module. See [#2294639] This runs after leaflet.js.
        'leaflet_imagepath' => array(
          'type' => 'inline',
          // Note: ends with "/"
          'data' => 'L.Icon.Default.imagePath = "' . base_path() . libraries_get_path('leaflet') . '/images/";',
        ),
      ),
      'css' => array(
        'leaflet.css' => array(
          'type' => 'file',
          'media' => 'all',
        ),
        'leaflet.ie.css' => array(
          'browsers' => array(
            'IE' => 'lte IE 8',
            '!IE' => FALSE,
          ),
        ),
      ),
    ),
    'integration files' => array(
      'leaflet' => array(
        'js' => array(
          'leaflet.drupal.js',
        ),
      ),
    ),
  );
  return $libraries;
}