You are here

function datatables_requirements in DataTables 6

Same name and namespace in other branches
  1. 7.2 datatables.install \datatables_requirements()
  2. 7 datatables.install \datatables_requirements()

Implementation of hook_requirements().

File

./datatables.install, line 11
Installation file for Datatables module.

Code

function datatables_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $requirements['datatables']['title'] = 'DataTables';
  if (file_exists(drupal_get_path('module', 'datatables') . '/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://plugins.jquery.com/project/DataTables',
      '@download' => 'http://plugins.jquery.com/files/dataTables-1.6.2.zip',
      '@readme' => url(drupal_get_path('module', 'datatables') . '/README.txt'),
    ));
    $requirements['datatables']['severity'] = REQUIREMENT_ERROR;
  }
  return $requirements;
}