I am writing a poll block. A poll has a title and some configurable answers.
Also I want to store the number of votes per answer independent of the translations, so the votes are the same across languages.
This is my blueprint:
name:
*: blocks.poll
icon: chat-poll-line
fields:
title:
type: text
label:
*: title
question:
type: textarea
buttons: false
label:
*: blocks.poll.question
required: true
answers:
type: structure
label:
*: blocks.poll.answers
fields:
text:
type: text
label:
*: blocks.poll.answer
icon:
type: text
votes:
type: number
label:
*: blocks.poll.votes
default: 0
required: true
columns:
text:
mobile: true
width: 9/10
icon:
mobile: true
width: 1/10
align: center
votes:
mobile: true
width: 1/10
align: right
That gives me this:
As far as I understand it, I need to store the numbers elsewhere (e. g. a text file) so I can de-couple votes from the translated blocks and have them be the same across languages.
- How can I show the number of votes in the panel? A block model method?
- How can I manipulate the votes from the backend, e. g. change or reset?
I was thinking maybe have a hook
