You are here

function isotope_requirements in Isotope (with Masonry and Packery) 7.2

Same name and namespace in other branches
  1. 7 isotope.install \isotope_requirements()

Implements hook_requirements().

File

./isotope.install, line 111
Installation functions.

Code

function isotope_requirements($phase) {
  $requirements = array();
  if ($phase == "runtime") {
    $requirements['isotope'] = array(
      'title' => t('Isotope library'),
      'value' => t('Enabled'),
    );
    $isotope_scope = isotope_check_library();

    // If Libraries API is enabled but the .js is not found within the
    // sites/all/libraries folder report a warning. The module will fall back to
    // its included copy so this isn't a showstopper.
    if (function_exists('libraries_get_path') && $isotope_scope == 'cdn') {
      $path = libraries_get_path('isotope');
      $path = !empty($path) ? $path : 'libraries/isotope';
      $requirements['isotope']['value'] = t('Isotope is not correctly using Libraries API');
      $requirements['isotope']['severity'] = REQUIREMENT_WARNING;
      $requirements['isotope']['description'] = t('Please install <a href="http://isotope.metafizzy.co/">Isotope</a> in <strong>%path</strong>. The module is using an external copy from %cdn', array(
        '%path' => $path . '/' . ISOTOPE_FILENAME,
        '%cdn' => ISOTOPE_CDN_PATH,
      ));
    }

    // If the external copy has been removed or renamed report an error. At this
    // point the module cannot function properly.
    if ($isotope_scope == FALSE) {
      $requirements['isotope']['value'] = t('Isotope is not correctly installed');
      $requirements['isotope']['severity'] = REQUIREMENT_ERROR;
      $requirements['isotope']['description'] = t('The external script is not available.  Please enable the Libraries API module AND install <a href="http://isotope.metafizzy.co/">Isotope</a> in the isotope directory in libraries (sites/all/libraries/isotope/%file).', array(
        '%file' => ISOTOPE_FILENAME,
      ));
    }
  }
  return $requirements;
}