AddressTestEventSubscriber.php in Address 8
File
tests/modules/address_test/src/EventSubscriber/AddressTestEventSubscriber.php
View source
<?php
namespace Drupal\address_test\EventSubscriber;
use Drupal\address\Event\AddressEvents;
use Drupal\address\Event\AvailableCountriesEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class AddressTestEventSubscriber implements EventSubscriberInterface {
public static function getSubscribedEvents() {
$events[AddressEvents::AVAILABLE_COUNTRIES][] = [
'onAvailableCountries',
];
return $events;
}
public function onAvailableCountries(AvailableCountriesEvent $event) {
$event
->setAvailableCountries($this
->getAvailableCountries());
}
public function getAvailableCountries() {
return [
'AU' => 'AU',
'BR' => 'BR',
'CA' => 'CA',
'GB' => 'GB',
'US' => 'US',
];
}
}