Occasionally, simple logic is required to determine which version of JQuery should be present on a particular page. An alter hook which allows for the overriding of the version in use would be immensely useful in these circumstances.

#2 jquery-update-override-2760999-1.patch832 bytesEc1ipsis
Members fund testing for the Drupal project. Drupal Association Learn more


Ec1ipsis created an issue. See original summary.

Ec1ipsis’s picture

markcarver’s picture

Version: 7.x-2.7 » 7.x-3.x-dev
Parent issue: » #2852350: [jquery_update] 7.x-3.0 stable release
markcarver’s picture

Status: Needs review » Needs work

I actually think the hook that is called should just be jquery_version, so that way it reads hook_jquery_version_alter() which makes a lot more sense.

I also think that we should clone this version before sending it to be altered and then check if the altered version is different and matches of the allowed versions. This way we can ensure it cannot get arbitrarily set to something that ultimately won't work.

It should be noted that these versions will likely become automated in the future via #1869928: Better CDN/API/automation support which will add API calls to determine available versions (so we don't have to worry about it getting stale).

Also, this will need to create a jquery_update.api.php file and place this hook definition/documentation.