You are here

function cufon_requirements in Cufón 6

Implementation of hook_requirements().

File

./cufon.install, line 26

Code

function cufon_requirements($phase) {
  $requirements = array();

  // search in libraries folders for cufon-yui.js library.
  $cufonLib = drupal_system_listing('cufon-yui.js', 'libraries');
  $file_exists = isset($cufonLib['cufon-yui']);

  // for backwards compatibility
  if (!$file_exists) {
    $js = dirname(__FILE__) . '/js';
    $file_exists = file_exists($js . '/cufon-yui.js');
  }
  if ($phase == 'runtime' || !$file_exists) {
    $requirements['cufon'] = array(
      'title' => t('Cufon'),
      'value' => $file_exists ? t('Cufon library installed') : t('<strong>Cufón:</strong> You must download <a href="http://cufon.shoqolate.com/js/cufon-yui.js">cufon-yui.js</a> and install it to <code>libraries/cufon</code>.'),
      'severity' => $file_exists ? REQUIREMENT_INFO : REQUIREMENT_ERROR,
    );
  }
  return $requirements;
}