[development] Time to remove poll module from core

Jonathan Chaffer jchaffer at structureinteractive.com
Wed May 3 18:00:43 UTC 2006


On May 3, 2006, at 1:49 PM, Derek Wright wrote:

> On May 3, 2006, at 10:04 AM, Jonathan Chaffer wrote:
>
>> You're talking about... dare I say it... a poll field type! Anyone  
>> who wants to attempt building such a beast for CCK is very welcome  
>> to. I will happily provide guidance.
>
> i'm torn about this:
>
> - if it's just a field, it's harder (i think) to have tabs on the  
> node page for doing interesting things with the poll.  for example,  
> polls currently allow you to view the poll (if you haven't voted)  
> and the results as separate tabs.  my patch in http://drupal.org/ 
> node/51561 adds yet another tab (for people w/ the right  
> permission) to view the actual votes (by username or IP/host for  
> anonymous).  i'm not sure if/how CCK field types handle this sort  
> of thing... if a field can register tabs when viewing the container  
> node.

Actually, on thinking about it, I think this is a model example for  
having a module-defined field (rather than field type). So we have:

- The poll module defines a text field with multiple values, called  
"poll_choices".
- Because it's a text field, text.module handles the input and  
validation, et cetera, and content.module handles the storage.
- The module notices when a content type has poll_choices attached to  
it (probably in nodeapi) and handles voting, display, et cetera.
- Fancy things like tabs are possible using the same mechanism.

There's a little back-end work to enable this yet to do, but I think  
that's a fairly clean approach.



More information about the development mailing list