You are here

function poll_cron in Poll 8

Implements hook_cron().

File

./poll.module, line 99
Collects votes on different topics in the form of multiple choice questions.

Code

function poll_cron() {

  // Close expired polls.
  $polls = \Drupal::entityTypeManager()
    ->getStorage('poll')
    ->getExpiredPolls();
  foreach ($polls as $poll) {
    $poll
      ->close();
    $poll
      ->save();
  }
}