You are here

function bootstrap_carousel_requirements in bootstrap_carousel 7

Implements hook_requirements().

File

./bootstrap_carousel.install, line 32
Install file for Bootstrap Carousel module.

Code

function bootstrap_carousel_requirements($phase) {

  // Create an array to hold Bootstrap Carousel requirements.
  $requirements = array();
  $t = get_t();

  // Check requirements during the runtime phase.
  if ($phase == 'runtime') {

    // Check if the Bootstrap javascript library is installed.
    if (($library = libraries_detect('bootstrap')) && !empty($library['installed'])) {
      $requirements['bootstrap_library'] = array(
        'title' => $t('Bootstrap library'),
        'value' => $t('Installed'),
        'severity' => REQUIREMENT_OK,
      );
    }
    else {
      $requirements['bootstrap_library'] = array(
        'title' => $t('Bootstrap library'),
        'value' => $t('Not installed'),
        'description' => $library['error message'],
        'severity' => REQUIREMENT_ERROR,
      );
    }
  }
  return $requirements;
}