public function ZoneTerritoryTestForm::submitForm in Address 8
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
- tests/
modules/ address_test/ src/ Form/ ZoneTerritoryTestForm.php, line 41
Class
- ZoneTerritoryTestForm
- Used to test the address_zone_territory form element.
Namespace
Drupal\address_test\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
$territory = new ZoneTerritory($values['territory']);
$this
->messenger()
->addMessage($this
->t('Submitted: @country_code / @administrative_area / @included_postal_codes / @excluded_postal_codes.', [
'@country_code' => $territory
->getCountryCode(),
'@administrative_area' => $territory
->getAdministrativeArea(),
'@included_postal_codes' => $territory
->getIncludedPostalCodes(),
'@excluded_postal_codes' => $territory
->getExcludedPostalCodes(),
]));
}