You are here

function jplayer_requirements in jPlayer 8.2

Same name and namespace in other branches
  1. 6 jplayer.install \jplayer_requirements()
  2. 7.2 jplayer.install \jplayer_requirements()

Implements hook_requirements().

File

./jplayer.install, line 16
Installation file for jPlayer module.

Code

function jplayer_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $requirements['jplayer']['title'] = t('jPlayer');
    if ($jplayer_version = jplayer_get_version()) {
      $requirements['jplayer']['value'] = $jplayer_version;
      $requirements['jplayer']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['jplayer']['value'] = t('Not found');
      $requirements['jplayer']['description'] = t('Missing the jPlayer library. Please !download and extract it into the %directory directory.', array(
        '!download' => \Drupal::l('download jPlayer library', \Drupal\Core\Url::fromUri('http://www.jplayer.org/download/')),
        '%directory' => \Drupal::config('jplayer.settings')
          ->get('jplayer_directory'),
      ));
      $requirements['jplayer']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}