public function AddCustomPlaceForm::submitForm in Weather 2.0.x
Same name and namespace in other branches
- 8 src/Form/AddCustomPlaceForm.php \Drupal\weather\Form\AddCustomPlaceForm::submitForm()
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- src/
Form/ AddCustomPlaceForm.php, line 201
Class
- AddCustomPlaceForm
- Configure Weather settings for this site.
Namespace
Drupal\weather\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$url = $form_state
->getValue('weather_yrno_url');
$url = trim($url) . 'forecast.xml';
if ($this->weatherParser
->downloadForecast('', $url)) {
$this->messenger
->addStatus($this
->t('The new place has been saved.'));
}
else {
$this->messenger
->addError($this
->t('The download from the given URL did not succeed.'));
}
}