Registers JavaScript/CSS libraries associated with a module.
Modules implementing this return an array of arrays. The key to each sub-array is the machine readable name of the library. Each library may contain the following items:
Registered information for a library should contain re-usable data only. Module- or implementation-specific data and integration logic should be added separately.
An array defining libraries associated with a module.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_library_info() {
// Library One.
$libraries['library-1'] = array(
'title' => 'Library One',
'website' => 'http://example.com/library-1',
'version' => '1.2',
'js' => array(
drupal_get_path('module', 'my_module') . '/library-1.js' => array(),
),
'css' => array(
drupal_get_path('module', 'my_module') . '/library-2.css' => array(
'type' => 'file',
'media' => 'screen',
),
),
);
// Library Two.
$libraries['library-2'] = array(
'title' => 'Library Two',
'website' => 'http://example.com/library-2',
'version' => '3.1-beta1',
'js' => array(
// JavaScript settings may use the 'data' key.
array(
'type' => 'setting',
'data' => array(
'library2' => TRUE,
),
),
),
'dependencies' => array(
// Require jQuery UI core by System module.
array(
'system',
'jquery.ui.core',
),
// Require our other library.
array(
'my_module',
'library-1',
),
// Require another library.
array(
'other_module',
'library-3',
),
),
);
return $libraries;
}