You are here

protected function WeatherDisplayPlaceForm::getAvailableCountriesOptions in Weather 8

Same name and namespace in other branches
  1. 2.0.x src/Form/WeatherDisplayPlaceForm.php \Drupal\weather\Form\WeatherDisplayPlaceForm::getAvailableCountriesOptions()

Builds array of options for 'country' select.

1 call to WeatherDisplayPlaceForm::getAvailableCountriesOptions()
WeatherDisplayPlaceForm::buildForm in src/Form/WeatherDisplayPlaceForm.php
Form constructor.

File

src/Form/WeatherDisplayPlaceForm.php, line 259

Class

WeatherDisplayPlaceForm
Form controller for the weather_display_place entity edit forms.

Namespace

Drupal\weather\Form

Code

protected function getAvailableCountriesOptions() {
  $result = $this->weatherPlaceStorage
    ->getAggregateQuery()
    ->groupBy('country')
    ->sort('country', 'ASC')
    ->execute();
  foreach ($result as $row) {
    $countries[$row['country']] = $row['country'];
  }
  return $countries;
}