public function ApprovalPollViewForm::showResults in Advanced Poll 8
Overrides PollViewForm::showResults
File
- src/Form/ ApprovalPollViewForm.php, line 193 
Class
- ApprovalPollViewForm
- Class ApprovalPollViewForm
Namespace
Drupal\advpoll\FormCode
public function showResults(PollInterface $poll, FormStateInterface $form_state) {
  $showResults = parent::showResults($poll, $form_state);
  if (!$showResults) {
    // Check duration.
    $duration = $this->poll
      ->getRuntime();
    if ($duration) {
      $startTimestamp = $this
        ->getStartTimestamp();
      if (empty($startTimestamp)) {
        $startTimestamp = $this->poll
          ->getCreated();
      }
      if ($startTimestamp + $duration < time()) {
        // End date is in the past.
        $showResults = TRUE;
      }
    }
  }
  return $showResults;
}