Implement hook_library to allow other modules to initialize the library when required. Related to this issue #1476036: Move away from hook_init() and into #attached, this would allow the module to be used as an API and on it's own with hook_init().

I'll have a patch later this evening.

#1 1713584-hook_library.patch2.57 KBminorOffense


minorOffense’s picture

Status:Active» Needs review
new2.57 KB

Here's the patch. It creates two library entries.

1) The chosen library itself
2) The files required to run the chosen.js supplied by the module.

Cyclodex’s picture

Thanks for the patch, I will test it later.
I think we should release a 7.x-1.2 and move this patch into a 1.3-dev or even 7.x-2.x-dev version.

minorOffense’s picture

That's fine with me. The change shouldn't affect any existing sites since it's the exact same drupal_add_js code as was there originally, just packed up into hook_library.

I've done some testing on my own and I haven't found any issues so far. If you need help testing or need a testing environment with the changes applied I can send you a Drupal site and db to try out.


arshadcn’s picture

Assigned:Unassigned» arshadcn

Interesting. I've created a 7.x-2.x branch. Assigning.

kalman.hosszu’s picture

Assigned:arshadcn» kalman.hosszu
kalman.hosszu’s picture

Status:Needs review» Fixed

I committed the modification to 2.x branch.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.