I'm porting cluetips to D6 and making it a JQ module.
Cluetips zip comes with all the JS files it needs (hoverIntent and dimensions), currently the module just uses them, however i would love it, if it could work out if a JQ module exists to take over the work and use that file instead (if avilable).
The problem is the jq_plugins() function. We need to call it in the MODULENAME_jq() hook, to assess if the local files for hoverIntent need to be used, but in calling jq_plugins() it triggers its own hook again, causing a loop.
Any nice way around this? or have i missed the point?
Comments
Comment #1
avpadernoIf you are porting the module to Drupal 6, you should know that the dimensions plugin is already included within jQuery 1.2.6 used by Drupal 6 (see the jQuery 1.2.6 release notes on Dimensions Plugin is Now Part of Core).
Comment #2
avpadernoIf what you want to do is to check if a plugin is available, before to use your own version of the plugin, you can call
jq_add()which returns a value useful to understand if the function has been able to load the required plugin (therefore, the plugin is already available).Comment #3
avpadernoI am changing the request title, as it seemed you were asking how to generally check if a module is available (which would lead somebody to reply with ).
Comment #4
avpadernoComment #5
guillaumeduveauWould this work ?
Comment #6
guillaumeduveauOups that was producing a fatal PHP error. Use
if ( in_array('your_plugin', jq_plugins()) ) {
...
}
Comment #7
ball.in.th commentedI believe the correct syntax for #6 would be:
Though it doesn't seem to be necessary because you can just check the return value of jq_add('your_plugin'); .
Comment #8
guillaumeduveau@ #7 if I remember well this is not right when the module is unavailable, since it adds a warning in watchdog.
Comment #9
avpadernoComment #10
avpadernoI am closing this issue since it's for a Drupal version that isn't supported.