You are here

public function PollStorage::getMostRecentPoll in Poll 8

Get the most recent poll posted on the site.

Return value

mixed

Overrides PollStorageInterface::getMostRecentPoll

File

src/PollStorage.php, line 74

Class

PollStorage
Controller class for polls.

Namespace

Drupal\poll

Code

public function getMostRecentPoll() {
  $query = \Drupal::entityQuery('poll')
    ->condition('status', POLL_PUBLISHED)
    ->sort('created', 'DESC')
    ->pager(1);
  return $this
    ->loadMultiple($query
    ->execute());
}