You are here

function leaflet_widget_library in Leaflet Widget for Geofield 7

Same name and namespace in other branches
  1. 7.2 leaflet_widget.module \leaflet_widget_library()

Implements hook_library().

File

./leaflet_widget.module, line 182

Code

function leaflet_widget_library() {
  $path = drupal_get_path('module', 'leaflet_widget');
  $leaflet_widget = libraries_get_path('Leaflet.widget');
  $libraries = array();
  $libraries['widget'] = array(
    'title' => 'Widget behavior',
    'version' => '1.x',
    'js' => array(
      "{$path}/js/widget.js" => array(),
    ),
    'dependencies' => array(
      array(
        'leaflet_widget',
        'Leaflet.widget',
      ),
    ),
  );
  $libraries['Leaflet.widget'] = array(
    'title' => 'Leaflet.widget',
    'version' => '1.x',
    'css' => array(
      "{$leaflet_widget}/dist/Leaflet.widget.min.css" => array(),
    ),
    'js' => array(
      "{$leaflet_widget}/dist/Leaflet.widget.js" => array(),
    ),
    'dependencies' => array(
      array(
        'leaflet_widget',
        'Leaflet.draw',
      ),
    ),
  );
  $libraries['Leaflet.draw'] = array(
    'title' => 'Leaflet.draw',
    'version' => '1.x',
    'css' => array(
      "{$leaflet_widget}/lib/Leaflet.draw/leaflet.draw.css" => array(),
    ),
    'js' => array(
      "{$leaflet_widget}/lib/Leaflet.draw/leaflet.draw-src.js" => array(),
    ),
    'dependencies' => array(
      array(
        'leaflet_widget',
        'Leaflet',
      ),
    ),
  );

  // If available, use the same Leaflet as Leaflet module. Otherwise use the
  // one bundled with Leaflet.widget.
  $leaflet = libraries_get_path('leaflet');
  $leaflet = !empty($leaflet) ? "{$leaflet}/dist/" : "{$leaflet_widget}/lib/Leaflet/";
  $libraries['Leaflet'] = array(
    'title' => 'Leaflet (Leaflet Widget)',
    'version' => '0.4.5',
    'css' => array(
      "{$leaflet}/leaflet.css" => array(),
      "{$leaflet}/leaflet.ie.css" => array(
        'browsers' => array(
          'IE' => 'lte IE 8',
        ),
      ),
    ),
    'js' => array(
      "{$leaflet}/leaflet-src.js" => array(),
    ),
  );
  return $libraries;
}