public function PollViewForm::showResults in Poll 8
2 calls to PollViewForm::showResults()
- PollViewForm::actions in src/
Form/ PollViewForm.php - PollViewForm::buildForm in src/
Form/ PollViewForm.php - Form constructor.
File
- src/
Form/ PollViewForm.php, line 143
Class
- PollViewForm
- Displays banned IP addresses.
Namespace
Drupal\poll\FormCode
public function showResults(PollInterface $poll, FormStateInterface $form_state) {
$account = $this
->currentUser();
switch (TRUE) {
// The "View results" button, when available, has been clicked.
case $form_state
->get('show_results'):
return TRUE;
// The poll is closed.
case $poll
->isClosed():
return TRUE;
// Anonymous user is trying to view a poll they aren't allowed to vote in.
case $account
->isAnonymous() && !$poll
->getAnonymousVoteAllow():
return TRUE;
// The user has already voted.
case $poll
->hasUserVoted():
return TRUE;
default:
return FALSE;
}
}