protected function WeatherDisplayPlaceForm::getAvailablePlacesOptions in Weather 8
Same name and namespace in other branches
- 2.0.x src/Form/WeatherDisplayPlaceForm.php \Drupal\weather\Form\WeatherDisplayPlaceForm::getAvailablePlacesOptions()
Builds array of options for 'place' select.
1 call to WeatherDisplayPlaceForm::getAvailablePlacesOptions()
- WeatherDisplayPlaceForm::buildForm in src/
Form/ WeatherDisplayPlaceForm.php - Form constructor.
File
- src/
Form/ WeatherDisplayPlaceForm.php, line 275
Class
- WeatherDisplayPlaceForm
- Form controller for the weather_display_place entity edit forms.
Namespace
Drupal\weather\FormCode
protected function getAvailablePlacesOptions(string $country) {
$places = [];
$result = $this->weatherPlaceStorage
->getQuery()
->condition('country', $country)
->sort('name', 'ASC')
->execute();
foreach ($result as $id) {
$place = $this->weatherPlaceStorage
->load($id);
$places[$place->geoid->value] = $place->name->value;
}
return $places;
}