function twitter_feed_requirements in Twitter_Feed 8
Implements hook_requirements().
File
- ./
twitter_feed.install, line 26 - Installation actions for Twitter Feed.
Code
function twitter_feed_requirements($phase) {
$requirements = [];
// Check to see if the Timeago library is available.
if ($phase == 'runtime') {
$installed = FALSE;
$requirements['timeago'] = [
'title' => 'Timeago',
];
if (function_exists('libraries_get_path')) {
$version = 1.5;
$requirements['timeago']['description'] = t('Version %version installed.', [
'%version' => $version,
]);
$requirements['timeago']['severity'] = REQUIREMENT_OK;
// @todo have the version automatically detected
$requirements['timeago']['value'] = $version;
$path = libraries_get_path('timeago');
$installed = file_exists($path . '/jquery.timeago.js');
}
// Check the results of the test.
if (!$installed) {
$requirements['timeago']['description'] = t('Timeago library not found. Please consult the README.txt for installation instructions.');
$requirements['timeago']['severity'] = REQUIREMENT_WARNING;
$requirements['timeago']['value'] = t('Timeago library not found.');
}
}
return $requirements;
}