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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

newsec’s picture

Issue summary: View changes
FileSize
1.05 KB

I support this issue, but patch is not modify the node object.
Created a new patch.

newsec’s picture

Status: Needs review » Reviewed & tested by the community
newsec’s picture

Issue tags: +drupal 7, +poll, +core

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1: poll_module_return_chid_new.patch, failed testing.

Status: Needs work » Needs review
newsec’s picture

Status: Needs review » Reviewed & tested by the community
David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

This 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:

-function poll_insert($node) {
+function poll_insert(&$node) {

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...