You are here

function color_field_requirements in Color Field 7.2

Same name and namespace in other branches
  1. 8.2 color_field.install \color_field_requirements()
  2. 7 color_field.install \color_field_requirements()

Implements hook_requirements().

File

./color_field.install, line 44
Install, update, and uninstall functions.

Code

function color_field_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    $color_field_library = drupal_get_library('color_field', 'jquery-simple-color');
    foreach ($color_field_library['js'] as $path => $js) {
      if (!file_exists($path)) {
        $requirements['jquery-simple-color'] = array(
          'severity' => REQUIREMENT_WARNING,
          'title' => $t('Color Field (jquery simple color)'),
          'value' => $t('Missing'),
          'description' => $t('The jquery simple color library isn\'t available so this Color Field Module will not support the jQuery Simple Color widget. Please download the plugin (%version) from !website.', array(
            '!website' => l($color_field_library['website'], $color_field_library['website']),
            '%version' => $color_field_library['version'],
          )),
        );
        break;
      }
    }
    if (!isset($requirements['jquery-simple-color'])) {
      $requirements['jquery-simple-color'] = array(
        'severity' => REQUIREMENT_OK,
        'title' => $color_field_library['title'],
        'value' => $color_field_library['version'],
      );
    }
  }
  return $requirements;
}