function twitter_feed_library_info_build in Twitter_Feed 8
Implements hook_library_info_build().
We also define Timeago through the core library callbacks.
File
- ./
twitter_feed.module, line 51 - Twitter module hooks.
Code
function twitter_feed_library_info_build() {
$lib = twitter_feed_libraries_info();
$libraries = [];
if (!function_exists('libraries_get_path')) {
return NULL;
}
$library_path = libraries_get_path('timeago');
if (strpos($library_path, '/') !== 0) {
$library_path = '/' . $library_path;
}
$libraries['timeago'] = [
'title' => $lib['timeago']['name'],
'remote' => $lib['timeago']['vendor url'],
'version' => '1.5.2',
'license' => [
'name' => 'MIT',
'url' => 'https://github.com/rmm5t/jquery-timeago/raw/master/LICENSE.txt',
'gpl-compatible' => TRUE,
],
'dependencies' => [
'core/jquery',
],
'js' => [
$library_path . '/jquery.timeago.js' => [
'scope' => 'footer',
],
],
];
$languages = twitter_feed_timeago_languages();
foreach ($languages as $language_name) {
$libraries['timeago_' . $language_name] = [
'title' => $lib['timeago']['name'],
'remote' => $lib['timeago']['vendor url'],
'version' => '1.5.2',
'license' => [
'name' => 'MIT',
'url' => 'https://github.com/rmm5t/jquery-timeago/raw/master/LICENSE.txt',
'gpl-compatible' => TRUE,
],
'dependencies' => [
'core/jquery',
],
'js' => [
$library_path . '/locales/jquery.timeago.' . $language_name . '.js' => [
'scope' => 'footer',
],
],
];
}
return $libraries;
}