Install module Poll:
composer require drupal/poll ; drush en poll -y
Go to the "Contents" page → "Polls":
Click "Add a poll" and add a new poll.
Write a question and answer options. Change the author, if necessary. Check all the boxes.
- Active - the poll is on, you can vote in it;
- Poll Duration - time during which the poll will be active;
- Allow anonymous votes - unregistered users will be able to vote;
- Allow cancel votes - you can cancel your choice and vote again;
- Allow view results - you can see the results of the poll, and not vote.
Separate pages are created for polls. Since this is the first poll on my site, it will have a path:
But you don't want polls as separate pages, but as part of the content of other pages.
That's why it's more convenient to create a paragraph with a "poll" field in it.
In display management, change the output format to "Entity Ready to Output":
Attach this paragraph to the material type field, or any other entity where you need to output a survey and add it through the autocomplete field.
We get the result:
Top comments (0)