protected function WeatherDisplayPlaceForm::getAvailablePlacesOptions in Weather 2.0.x
Same name and namespace in other branches
- 8 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 288
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;
}