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.
While limited, the poll module is sometimes just what the doctor ordered for a single multiple choice question. Unfortunately, it doesn't allow other modules to hook into the poll choices very well. Instead of just saving the choices, this patch additionally places their newly minted ids into the node object for other modules to use in hook_insert implementations.
Comment | File | Size | Author |
---|---|---|---|
#1 | poll_module_return_chid_new.patch | 1.05 KB | newsec |
poll_module_return_chid.patch | 766 bytes | yareckon | |
Comments
Comment #1
newsec CreditAttribution: newsec commentedI support this issue, but patch is not modify the node object.
Created a new patch.
Comment #2
newsec CreditAttribution: newsec commentedComment #3
newsec CreditAttribution: newsec commentedComment #6
newsec CreditAttribution: newsec commentedComment #7
David_Rothstein CreditAttribution: David_Rothstein commentedThis looks like a good idea, but I think an automated test should be added here? (Because it's essentially a bug, that you can call node_save() on a poll and $node->choice is not updated to reflect what was saved - so it should be possible to test something like that.)
Also, the original patch looks correct to me, not #1:
This code (added in #1) should not be necessary since Drupal 7 requires PHP 5, and in PHP 5 objects automatically inherit changes made to them...