You are here

function mixitup_views_requirements in MixItUp Views 7

Implements hook_requirements().

File

./mixitup_views.install, line 11
Installation file for the mixitup_views module.

Code

function mixitup_views_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $library = libraries_detect('mixitup');
    if (empty($library['installed'])) {
      $requirements['mixitup_plugin'] = array(
        'title' => $t('MixItUp library'),
        'value' => $t('At least @a', array(
          '@a' => '2.1.9',
        )),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('You need to download the !mix and
           place it to the root of "mixitup" directory in the %path directory on your server.', array(
          '!mix' => l($t('jquery.mixitup.min.js'), $library['download url']),
          '%path' => 'sites/all/libraries',
        )),
      );
    }
    elseif (version_compare($library['version'], '2.1.9', '>=')) {
      $requirements['mixitup_plugin'] = array(
        'title' => $t('MixItUp library'),
        'severity' => REQUIREMENT_OK,
        'value' => $library['version'],
      );
    }
    else {
      $requirements['mixitup_plugin'] = array(
        'title' => $t('MixItUp library'),
        'value' => $t('At least @a', array(
          '@a' => '2.1.9',
        )),
        'severity' => REQUIREMENT_ERROR,
        'description' => $t('You need to download a later version of the !mix and replace the old version
            located in the %path directory on your server. Now is installed !v version', array(
          '!mix' => l($t('jquery.mixitup.min.js'), $library['download url']),
          '%path' => $library['library path'],
          '!v' => $library['version'],
        )),
      );
    }
  }
  return $requirements;
}