You are here

function responsive_navigation_requirements in Responsive Navigation 7

Implements hook_requirements().

File

./responsive_navigation.install, line 42
Install, update, and uninstall functions for the responsive_navigation module.

Code

function responsive_navigation_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $requirements['responsive_navigation']['title'] = t('responsive-nav.js library');
    if (module_exists('libraries') && function_exists('libraries_get_libraries')) {
      $library = libraries_get_libraries();
      $rnjs_installed = isset($library['responsive_navigation']) ? TRUE : FALSE;
    }
    elseif (_rnjs_installed($phase)) {
      $rnjs_installed = TRUE;
    }
    else {
      $rnjs_installed = FALSE;
    }
    if ($rnjs_installed) {
      $requirements['responsive_navigation']['value'] = $t('Installed');
      $requirements['responsive_navigation']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['responsive_navigation']['value'] = $t('Not installed');
      $requirements['responsive_navigation']['severity'] = REQUIREMENT_ERROR;
      $requirements['responsive_navigation']['description'] = $t('Please download the responsive-nav.js library from !link.', array(
        '!link' => l(RNJS_SITE_URL, RNJS_SITE_URL),
      ));
    }
  }
  return $requirements;
}