Can I provide default choice option for poll? which mean I want fix options 'Yes' and 'No' for choice for every poll created by users.
I want to make these fields type hidden with the choice 'Yes' and 'No'.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | advpoll_default_choices.patch | 1.98 KB | anders.fajerson |
| #3 | advpoll_default_choices.patch | 1.99 KB | anders.fajerson |
Comments
Comment #1
anders.fajerson commentedNo, but this would be a nice addition on the content type settings page (I've actually thought of that recently). Some of the code at http://drupal.org/node/145863#comment-317127 could probably be re-used since a textarea with one choice per row makes sense here. I guess we could also provide a setting to "hide" this default choices on the edit page.
The other option is to use hook_form_alter() to programatically interact with the form on the edit page.
Comment #2
anders.fajerson commentedI'd like to get this in before 1.0. I see what I can do.
Comment #3
anders.fajerson commentedSome duplicate code in advpoll_form, but I couldn't come up with a better way to write this. I'll take care of "uninstalling" the new variable in the issue dealing with that.
Comment #4
ChrisKennedy commentedNice, I like the simple way of implementing this.
One nitpick: for the first variable_get, make the default value NULL, then check !isset() [or !== NULL] rather than !empty() so that 0 can be the only default choice (might as well allow it).
Otherwise, RTBC.
Comment #5
nancydruI like to set all my defaults in hook_enable. Then it's easy to reset them: disable and re-enable it.
Comment #6
anders.fajerson commentedChanged to
$default_choices != ''and kept default value as''. The default value will only be set if the user never saved the content type settings page, else it's saved as''to the variable table.Comment #7
ChrisKennedy commentedSounds good to me.
Comment #8
anders.fajerson commentedCommitted: http://drupal.org/cvs?commit=89969
Comment #9
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.