diff --git a/poll.module b/poll.module index ed12dcd..1e51839 100644 --- a/poll.module +++ b/poll.module @@ -58,6 +58,8 @@ function poll_theme() { 'votes' => NULL, 'block' => NULL, 'pid' => NULL, + 'poll' => NULL, + 'view_mode' => NULL, 'vote' => NULL, 'show_question' => FALSE, ), diff --git a/src/Form/PollViewForm.php b/src/Form/PollViewForm.php index f576194..2041c1b 100644 --- a/src/Form/PollViewForm.php +++ b/src/Form/PollViewForm.php @@ -65,7 +65,7 @@ public function buildForm(array $form, FormStateInterface $form_state, Request $ } } - $form['results'] = $this->showPollResults($this->poll); + $form['results'] = $this->showPollResults($this->poll, $view_mode); // For all view modes except full and block (as block displays it as the // block title), display the question. @@ -224,7 +224,7 @@ protected function actions(array $form, FormStateInterface $form_state, $poll) { * * @return array $output */ - function showPollResults(PollInterface $poll, $block = FALSE) { + function showPollResults(PollInterface $poll, $view_mode = 'default', $block = FALSE) { // Ensure that a page that shows poll results can not be cached. \Drupal::service('page_cache_kill_switch')->trigger(); @@ -260,6 +260,8 @@ function showPollResults(PollInterface $poll, $block = FALSE) { '#votes' => $total_votes, '#block' => $block, '#pid' => $poll->id(), + '#poll' => $poll, + '#view_mode' => $view_mode, '#vote' => isset($poll->vote) ? $poll->vote : NULL, );