Libraries API module

Drupal

As much as I love Drupal sometimes the documentation of them or module developers does not have detailed description.

Today I struggled with the Libraries API module and the simple setup of an info file for my library. I wanted to add the jquery.scrollTo plugin and followed the documentation saying:

You can do this either by implementing hook_libraries_info() in your module or by providing an info file for your library, which users then have to download. The info file should be in the same format as a regular Drupal info file for a module or theme, and should contain exactly the same keys that are described in hook_libraries_info().

The key for the JavaScript files for example would be "js". Instead you need to add to your info file "files[js][]".

The following example demonstrates the info file of the scrollTo plugin:

title = "jQuery ScrollTo"
website = "http://flesler.blogspot.co.il"
version = "1.4.3.1"
files[js][] = jquery.scrollTo.js

The last thing you have to consider is the naming rule for the info file.

LIBRARY_NAME.libraries.info => scrollto.libraries.info

Where your info file needs to be in the main library folder and the LIBRARY_NAME is a subfolder.

Tags: 
Drupal 7
libraries
info files