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.
The current behaviour of popups_reference with multi-value nodereference fields, is that it looks for an empty form element to populate with the newly-created reference, and if none is available, it simply overwrites the value of the first already-populated element. This is not ideal.
Attached patch does the following:
- If no empty nodereference form element is available, it calls jQuery's
triggerHandler('mousedown')
for the 'Add another item' button (if such a button is available). - It wraps the code for populating the newly created reference in a
fadeTo()
call, in order to delay this for 2 seconds. This is a bit of a hackish solution, but it's the only way I could ensure (albeit still not guarantee) that the AHAH callback for 'add another item' finishes before we try to populate it. Any other ideas are welcome. For now, this works pretty well for me. - Makes the newly created reference get added to the nodereference form element with nid, not just with title. We have the nid available, so we should use it.
Comment | File | Size | Author |
---|---|---|---|
popups_reference_trigger_handler.patch | 2.31 KB | Jaza |