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.
I'm returning a view display for a preview that contains an edit link to the node being referenced. I'd like the edit link to popup a modal frame, so I've added the automodal class to the views output.
The attached patch is required to run Drupal.attachBehaviors on the results of the view output correctly.
Comment | File | Size | Author |
---|---|---|---|
#1 | nodereference_explorer-preview_attachBehaviors-2.patch | 1022 bytes | jpklein |
nodereference_explorer-preview_attachBehaviors.patch | 981 bytes | blakehall |
Comments
Comment #1
jpklein CreditAttribution: jpklein commented+1 for getting this rolled into the next release; I just spent three hours hunting this down myself in order to get Lightbox2 to bind to preview images.
Building on what blakehall wrote, I'd suggest getting rid of the call to Drupal.attachBehaviors(this) altogether. In the scope of $.getJSON, 'this' refers to the JSON request object, which doesn't contain any of the returned data.
Additionally, I'd tweak the patch by passing the 'preview' DOM object without a jQuery wrapper to reduce overhead. See the attachment for my updates.
Comment #2
gnindl CreditAttribution: gnindl commentedTested & committed latest patch - great work, thanks!