You are here

function gathercontent_requirements in GatherContent 8

Same name and namespace in other branches
  1. 8.3 gathercontent.install \gathercontent_requirements()
  2. 7.3 gathercontent.install \gathercontent_requirements()
  3. 7 gathercontent.install \gathercontent_requirements()
  4. 7.2 gathercontent.install \gathercontent_requirements()

Implements hook_requirements().

File

./gathercontent.install, line 212
Install and uninstall script for GatherContent module.

Code

function gathercontent_requirements($phase) {
  if ($phase !== 'runtime') {
    return array();
  }
  $t = 't';
  $requirements = array(
    'gathercontent_tablesorter' => array(
      'title' => $t('GatherContent: Tablesorter plugin'),
      'value' => $t('Unavailable.'),
      'description' => $t('Install <a href="@libraries-page">Libraries</a> module.', array(
        '@libraries-page' => 'https://www.drupal.org/project/libraries',
      )),
      'severity' => REQUIREMENT_INFO,
    ),
  );
  if (\Drupal::moduleHandler()
    ->moduleExists('libraries')) {
    $tablesorter_lib_info = libraries_detect('tablesorter-mottie');
    if ($tablesorter_lib_info['installed'] && $tablesorter_lib_info['version']) {
      $requirements['gathercontent_tablesorter']['value'] = $tablesorter_lib_info['version'];
      $requirements['gathercontent_tablesorter']['severity'] = REQUIREMENT_OK;
      unset($requirements['gathercontent_tablesorter']['description']);
    }
    else {
      $requirements['gathercontent_tablesorter']['description'] = $t('Download <a href="@tablesorter-github">Mottie\'s tablesorter plugin</a> to <code>sites/all/libraries</code> toget sortable table headers at GatherContent admin UI. Rename it\'s folder to <code>tablesorter-mottie</code>.', array(
        '@tablesorter-github' => 'https://github.com/Mottie/tablesorter/archive/v2.25.8.zip',
      ));
    }
  }
  return $requirements;
}