You are here

public function VoteManager::getVoteTypes in Fivestar 8

Get vote types.

Return value

array An associative array with keys equal to the vote type machine ID and values equal to the vote type human-readable label.

File

src/VoteManager.php, line 56

Class

VoteManager
Contains methods for managing votes.

Namespace

Drupal\fivestar

Code

public function getVoteTypes() {
  $options = [];
  $vote_type_storage = $this->entityTypeManager
    ->getStorage('vote_type');
  foreach ($vote_type_storage
    ->loadMultiple() as $vote_type) {
    $options[$vote_type
      ->id()] = $vote_type
      ->label();
  }
  return $options;
}