Same name and namespace in other branches
  1. 3.0.x color_field.install \color_field_requirements() 1 comment
  2. 7.x-1.x color_field.install \color_field_requirements() 1 comment
  3. 8.x-2.x color_field.install \color_field_requirements() 1 comment

Implements hook_requirements().

File

./color_field.install, line 44

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;
}