Version 2.0
| Project: | jQuery Plugin Handler (JQP) |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | skilip |
| Status: | closed |
Jump to:
As discussed with jjeff we're planning to take the javascript module a few steps further. There has been a huge [discussion] about what Drupal is going to do to avoid more plugin wrapper modules from being released. The goal of the discussion is to take plugin handler functionality into core for D7.
So we've had to think about the future of jQp. Our goals are rather straightforward. With plugin handling in core in D7, jQp in it's current state will become useless. However D7 won't have a UI for managing the registered plugins. jQp will take care of that part in D7.
Until the release of D7 there's still a need for a better system of registering and managing javascript libraries in D6. I've written the attached module as a replacement for the current version of jQp, or rather a new version of it.
This is what it does:
- It provides a clear and solid structure for managing and registering plugins or javascript libraries. Registering javascript libraries can either be done by modules or by .info files in a structured directory hierarchy similar to the modules and themes structure.
- It provides an API which allows module developers to register and load required modules.
- It provides an UI in which site administrators can easily see if all javascript libraries are correctly installed.
- In the UI missing files can easily be recovered by either downloading the missing files or by searching for them using an autocomplete textfield.
- It provides versioning. Plugins can have several versions and different modules may require different versions. This module covers that.
User cases:
- 1) A site administrator has downloaded a module which depends on a jQuery plugin.
- After installing the module, a message is displayed telling the administrator a required file, or a complete plugin is missing. The administrator goes to admin/build/libraries and sees which libraries are registered and which are installed correctly and which are not. At this page the required files can either be downloaded or recovered.
- 2) A web developer creates a custom module which depends on a javascript library.
- With our D6 version he'll use hook_javascript_libraries() to register the required files for the plugin in the javascript library registry. (In Drupal 7 this will probably hook_plugins). Using the function drupal_add_javascript_library() the plugin can be loaded.
- 3) A theme developer creates theme which depends on javascript library 'foo'.
- Since we don't want to force theme developers creating modules, just for registering a javascript library, we take the advantage of .info files. The theme developer just adds a new folder named 'foo'. Inside the folder he places all required files for the javascript library as well as an .info file. This .info file will take care of registering the library into the registry.
I'll write a patch for this or commit this after your green light.
| Attachment | Size |
|---|---|
| directory_structure.png | 45.76 KB |
| javascript_libraries_page.png | 72.36 KB |
| javascript_libraries.zip | 13.96 KB |

#1
GREEN LIGHT!!!
This looks great! Super awesome even. :-)
#2
Committed a while ago
#3
Automatically closed -- issue fixed for 2 weeks with no activity.