You are here

function clipboardjs_requirements in Clipboard.js 7

Implements hook_requirements().

File

./clipboardjs.install, line 11
Install, update and uninstall functions for the Clipboard.js module.

Code

function clipboardjs_requirements($phase) {
  $requirements = array();

  // Check requirements during the runtime phase.
  if ($phase == 'runtime') {
    $t = get_t();
    $library = libraries_detect('clipboard');
    if ($library['installed']) {
      $requirements['clipboard'] = array(
        'title' => $t('%library', array(
          '%library' => $library['name'],
        )),
        'value' => $t('Installed %version', array(
          '%version' => $library['version'],
        )),
        'severity' => REQUIREMENT_OK,
      );
    }
    else {
      $requirements['clipboard'] = array(
        'title' => $t('%library', array(
          '%library' => $library['name'],
        )),
        'value' => $t('Not installed'),
        'description' => $library['error message'],
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}