You are here

function taxonomy_image_requirements in Taxonomy Image 5

Same name and namespace in other branches
  1. 6 taxonomy_image.install \taxonomy_image_requirements()

Implementation of hook_requirements().

File

./taxonomy_image.install, line 13
taxonomy_image.install Simple module for providing an association between taxonomy terms and images. Written by Jeremy Andrews <jeremy@kerneltrap.org>, May 2004.

Code

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

  // Ensure translations don't break at install time
  $t = get_t();

  // Check for GD support.
  $requirements['gd'] = array(
    'title' => $t('GD Library'),
  );
  if (extension_loaded('gd')) {
    $gd = gd_info();
    $requirements['gd']['value'] = $gd['GD Version'];
    unset($gd['GD Version']);
    if ($gd['FreeType Support']) {
      $gd['FreeType Support' . ' ' . $gd['FreeType Linkage']] = 1;
      unset($gd['FreeType Support'], $gd['FreeType Linkage']);
    }
    $requirements['gd']['description'] = '<small>' . implode(', ', array_keys(array_filter($gd))) . '</small>';
    $requirements['gd']['severity'] = REQUIREMENT_OK;
  }
  else {
    $requirements['gd']['value'] = $t('Disabled');
    $requirements['gd']['description'] = $t('The Taxonomy Image module requires that you configure PHP with GD support.');
    $requirements['gd']['severity'] = REQUIREMENT_ERROR;
  }
  return $requirements;
}