For people who are new to using the jquery_plugin module, it sometimes is very useful to inform them when a plugin is not correctly installed. This patch adds a function to the module which checks the existence of a plugin.

CommentFileSizeAuthor
jquery_plugin_plugin_exists.patch1.94 KBskilip
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

skilip’s picture

Forgot to mention, if the plugin isn't found, a message is displayed including the name of the plugin, and an optional url of the plugins project page. The function jquery_plugin_exists also looks for 'jquery.name. src.jc' and 'jquery.name. pack.js' plugins, so you don't have to rename all plugins into 'jquery.name.min.js' anymore.

mfb’s picture

I think this would be a useful function, so modules could call it in their hook_requirements(). I don't think we need the extra complexity of $message_values.

Note, my goal with this module is to always provide the minified version of plugins (even if I have to minify them myself) so the only reason you would look for pack and src is if people are adding their own plugins.

We should make the "min" version always preferred. Also, if you want to support js files that have no "type" then you also want to take into account the dots, right now you are looking for "jquery.plugin..js"

skilip’s picture

I totally agree on using .min versions of the plugins. Even more now I know your module is not intended to be used as a central point for all downloaded plugins. I was using the module incorrectly, as you noticed. In a development environment however, using only .min versions, is not desirable. But then it is better to us an other jQuery plugin module.

mfb’s picture

Yes, what I've done is had a module require jquery_plugin once I got it working fully and created a release.

It might be a good idea in the future to include both source and minified javascript in this module. I just hadn't thought of that before because I wasn't doing any JS debugging (at least on the plugin files) with this module.

skilip’s picture

Assigned: skilip » Unassigned
mfb’s picture

Status: Needs work » Closed (won't fix)

I don't plan to add this feature - it's pretty late in the d6 cycle already.