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.
I am breaking this out of the general discussion #589210: The future of Pollfield. Especially the comments #9-14 are about this problem. Currently we have a problem because of the need to create a (unhideable) question for the poll AND the Drupal requirement to give a node title. This results in a double display of the question and hinders the creation of a usable independent content type.
Comments
Comment #1
mario_prkos CreditAttribution: mario_prkos commentedIf you don't need views question formatter that mean that you don't need views which will list all questions of polls filtered by something. You can just put the question in title and for question put ' ' (there is space between them). ' ' means that question is empty and will not be displayed.
Comment #2
dddave CreditAttribution: dddave commentedlol
This module should have its own docs page. I could start one during this week if you don't beat me to it. Always wanted to explore how to properly create such a book page.
Ok, I tried this and it worked well. I am going to explore how this impacts usability especially with views.
Comment #3
mario_prkos CreditAttribution: mario_prkos commentedSuper, great!!! I put some new features and improve some views formatters, also I solved some issues about anonymous voting policy.
You can check out. It will available after 12:00 GMT in dev version. I am so excited to see this module full equipped.
Comment #4
dddave CreditAttribution: dddave commentedRe #1:
Is there any difference in functionality or usability if I don't use the question field but instead have my question in the title field? It seems to me that the options I have are the same, i.e. there are no special options when I use the question field. All I can do with the content of this field I can do with a node title, can't I? Instead "Content:......" I can use "Node: Title" for example at the filter settings of a view.
Comment #5
mario_prkos CreditAttribution: mario_prkos commentedYes, you are right you can filter content by node: title. Probably, you can do everything as the question is put in the question field. There is no really any issue regard to the empty question. Only thing is that question formatter is than empty but you can use node title instead of it. When you use views with cck (Conten) you have option Format which is in bottom of configuration form. Pollfield has several ways which can be displayed by views:default, question, all results, all choices and runtime.
1. deafault: ordinary display as you can see it in node
2. question: displays only question of poll so you can for example make views that lists only questions of active polls
3. results: displays results and question of poll (you can make views which will display only results of poll for print or analyze purpose)
4. choice: displays choices of poll
5. runtime: displays duration of poll
You can use different formatters for different purpose that is beauty of CCK modules.
Comment #6
dddave CreditAttribution: dddave commentedThis is fixed and documented.
Comment #8
pasena CreditAttribution: pasena commented2 mario_prkos
You've said "3. results: displays results and question of poll (you can make views which will display only results of poll for print or analyze purpose)"
It shows the choices, bars and results in per cent and votes count. How do I make the view to show for example results in per cents only? I'm a new guy in php, tried to look through the code, it's really hard. You must be genius. Thanks a lot for this modul!
Comment #9
mario_prkos CreditAttribution: mario_prkos commentedEverything what is display in pollfield is results of theme functions. In the function pollfield_theme() you declare all yours displays (themes). Those which is connected with views have prefix formatters.You can edit some existing one or put another one. Pollfield has formatters:
theme_pollfield_formatter_default,
theme_pollfield_formatter_results,
theme_pollfield_formatter_block_default,
theme_pollfield_formatter_choices,
theme_pollfield_formatter_question,
theme_pollfield_formatter_runtime,
As you can see all of this functions have html as output. You can override them in your theme or change it in module. Override is better solution because after module is updated you change will be preserve in your theme. For your purpose you need to change theme_pollfield_formatter_results and edit parts where you can see html code. Also you can install dev module and use dpm($variable_name) to display content of different php variables.
Results is displayed in part:
just delete what you don't want.
I hope it helps.
Comment #10
pasena CreditAttribution: pasena commentedThanks a lot for help! It helped. This is the best poll module.