You are here

datatables.install in DataTables 7

Same filename and directory in other branches
  1. 6 datatables.install
  2. 7.2 datatables.install

Installation file for Datatables module.

File

datatables.install
View source
<?php

/**
 * @file
 * Installation file for Datatables module.
 */

/**
 * Implements hook_requirements().
 */
function datatables_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $requirements['datatables']['title'] = 'DataTables';
    $requirements['datatables']['value'] = NULL;
    if (file_exists(drupal_get_path('module', 'datatables') . '/dataTables/media/js/jquery.dataTables.js')) {
      $requirements['datatables']['severity'] = REQUIREMENT_OK;
    }
    elseif (module_exists('libraries') && file_exists(libraries_get_path('datatables') . '/media/js/jquery.dataTables.js')) {
      $requirements['datatables']['severity'] = REQUIREMENT_OK;
    }
    else {

      // Required datatables library wasn't found. Abort installation.
      $requirements['datatables']['value'] = $t('Not found');

      // Provide a download link to the DataTables jQuery Plugin.
      $requirements['datatables']['description'] = $t('The <a href="!datatables">DataTables</a> plugin is missing. <a href="!download">Download</a> and extract it to your <em>datatables</em> module directory. See <a href="!readme">README.txt</a> for more info.', array(
        '!datatables' => 'http://datatables.net/',
        '!download' => 'http://datatables.net/releases/DataTables-1.9.0.zip',
        '!readme' => 'http://drupalcode.org/project/datatables.git/blob_plain/refs/heads/7.x-1.x:/README.txt',
      ));
      $requirements['datatables']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}

Functions

Namesort descending Description
datatables_requirements Implements hook_requirements().