Skip to main content
26 votes
Accepted

How to set value for multivalue field in drupal 8 programmatically

I would rewrite your code like this. N.B.: This an edited version of the original answer, following some helpful points coming from the comments. $poll = Poll::load($pollid); $poll->question->...
Stefanos Petrakis's user avatar
10 votes

How to set value for multivalue field in drupal 8 programmatically

You can work with multi value fields like an array. The field interface will translate this to store it in the database. To simplify it even more: $target_ids = array(13,14,15); $node_poll = Poll::...
4uk4's user avatar
  • 101k
2 votes
Accepted

How can I change the label for the vote button?

You need to implement hook_form_alter() for altering the poll_view_voting form and change #value from Vote to Submit. function mymodule_form_poll_view_voting_alter(&$form, &$form_state, $...
Ramdas Gaikar's user avatar
1 vote

How to hide all nodes of a particular content type?

The quickest way to achieve this would be to add Views Bulk Operations module to augment Views with new actions (including a 'select all results'), then creating an administrative View that shows all ...
Kevin's user avatar
  • 27.9k
1 vote

How to hide all nodes of a particular content type?

Try the Rabbit Hole module: Rabbit Hole is a module that adds the ability to control what should happen when an entity is being viewed at its own page. Perhaps you have a content type that never ...
baikho's user avatar
  • 1,737
1 vote
Accepted

How to filter Data on the basis of id or uuid by Rest API?

You haven’t set up any exposed filters or you’re using the wrong filter id on them. Views needs exposed filters on it by which to limit a query by.
Kevin's user avatar
  • 27.9k
1 vote

Send an email notification to admin prior to poll close date

You will need to create a Rule that will schedule component evaluation (send email). CREATE COMPONENT Create component plugin of type Rule (admin/config/workflow/rules/components/add) - name it "...
oksana-c's user avatar
  • 2,821
1 vote

How do I submit call handler on radio button selection?

It's been a while since this was posted but I hope this answer can help anyway The simple way I found to do it (I'm using the advpoll module as well) is to add the same AJAX handler to the options ...
Andrew Morris's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible