Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Image Caption uses hook_nodeapi to trigger the loading of the JavaScript. If you use Panels to override the ode display for certain content types (quite common), then the JS does not load, as hook_nodeapi()
does not fire with the view
op - it only uses the load
op.
Another way could be to use something like
function image_caption_init() {
if (arg(0) == 'node' && is_numeric(arg(1)) & !arg(2)) {
....
}
}
Untested, but quite standard for detecting if you are on a node view page - technique used throughout core.
Comment | File | Size | Author |
---|---|---|---|
#1 | 934676-image_caption-panels-support.patch | 1.03 KB | mrfelton |
Comments
Comment #1
mrfelton CreditAttribution: mrfelton commentedPatch attached.
Comment #2
jemond CreditAttribution: jemond commentedI can confirm this works in production.
Comment #3
jemond CreditAttribution: jemond commentedSince this patch is two years old and the module hasn't had a commit in a year, I went with a custom module fix for this issue that uses a slightly difference approach: