You are here

function background_video_requirements in Background Video 7

Implements hook_requirements(). This function check that the third party library Jquery-VideoBackground is available or not.

File

./background_video.install, line 47
This file provides the uninstall function.

Code

function background_video_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {
    if (function_exists('libraries_detect')) {
      $info = libraries_detect('jquery-videobackground');
      if ($info['installed'] == FALSE) {
        $requirements['jquery-videobackground'] = array(
          'title' => t('jQuery VideoBackground'),
          'severity' => REQUIREMENT_ERROR,
          'value' => t('jquery-videobackground library not installed. Download it from <a href="@source-url" target="_blank">the official page</a>. This module expects the library to be at sites/all/libraries/jquery-videobackground/script/jquery.videobackground.js , along with other .js files.', array(
            '@source-url' => 'https://github.com/georgepaterson/jquery-videobackground',
          )),
        );
      }
      else {
        $requirements['jquery-videobackground'] = array(
          'title' => t('jQuery VideoBackground'),
          'severity' => REQUIREMENT_OK,
          'value' => t('jquery-videobackground library installed. <strong>Version detected: @version</strong>.', array(
            '@version' => $info['version'],
          )),
        );
      }
    }
  }
  return $requirements;
}