You are here

leaflet.install in Leaflet 7

Same filename and directory in other branches
  1. 8 leaflet.install
  2. 2.1.x leaflet.install
  3. 2.0.x leaflet.install

Install, update, and uninstall functions for the leaflet module.

File

leaflet.install
View source
<?php

/**
 * @file
 * Install, update, and uninstall functions for the leaflet module.
 */

/**
 * Implements hook_requirements().
 */
function leaflet_requirements($phase) {
  $requirements = array();
  $t = get_t();

  // Verify the Leaflet library is installed correctly.
  if (in_array($phase, array(
    'runtime',
    'update',
  ))) {
    $library = libraries_detect('leaflet');
    $requirements['leaflet'] = array(
      'title' => $t('Leaflet'),
    );
    if ($library['installed']) {
      $requirements['leaflet'] += array(
        'value' => $library['version'],
        'description' => t('The Leaflet Javascript library is installed correctly. @maps available.', array(
          '@maps' => format_plural(count(leaflet_map_get_info()), 'One map', '@count maps'),
        )),
        'severity' => REQUIREMENT_OK,
      );
    }
    else {
      $requirements['leaflet'] += array(
        'value' => $library['error'],
        'description' => $library['error message'],
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}

Functions

Namesort descending Description
leaflet_requirements Implements hook_requirements().