function responsive_preview_requirements in Responsive Theme Preview 7
Implements hook_requirements().
File
Code
function responsive_preview_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$libraries = array(
'underscore' => 'Underscore',
'backbone' => 'Backbone',
);
foreach ($libraries as $lib => $label) {
$requirements['responsive_preview_' . $lib] = array(
'title' => t('Responsive preview: @library library', array(
'@library' => $label,
)),
'value' => t('The @library library is not present', array(
'@library' => $label,
)),
'severity' => REQUIREMENT_ERROR,
);
if (function_exists('libraries_detect')) {
if (($library = libraries_detect($lib)) && !empty($library['installed'])) {
$requirements['responsive_preview_' . $lib]['value'] = t('@version (@variant)', array(
'@version' => $library['version'],
// @todo This is problematic, because there is no way to enforce a
// certain variant.
'@variant' => _responsive_preview_libraries_get_preferred_variant_name($library),
));
$requirements['responsive_preview_' . $lib]['severity'] = REQUIREMENT_OK;
}
elseif (!empty($library['error'])) {
$requirements['responsive_preview_' . $lib]['description'] = $library['error message'];
}
}
}
}
return $requirements;
}