AddressFormatSubscriber.php in Open Social 10.0.x
Same filename and directory in other branches
- 8.9 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 8 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 8.2 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 8.3 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 8.4 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 8.5 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 8.6 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 8.7 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 8.8 modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 10.3.x modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 10.1.x modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
- 10.2.x modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.php
Namespace
Drupal\social_group\EventSubscriberFile
modules/social_features/social_group/src/EventSubscriber/AddressFormatSubscriber.phpView source
<?php
namespace Drupal\social_group\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\address\Event\AddressEvents;
/**
* Class AddressFormatSubscriber.
*
* @package Drupal\social_group\EventSubscriber
*/
class AddressFormatSubscriber implements EventSubscriberInterface {
/**
* Get the subscribed events.
*
* @return mixed
* Returns the subscribed events.
*/
public static function getSubscribedEvents() {
$events[AddressEvents::ADDRESS_FORMAT][] = [
'onGetDefinition',
0,
];
return $events;
}
/**
* The onGetDefinition function.
*/
public function onGetDefinition($event) {
$definition = $event
->getDefinition();
// This makes all address fields optional for all entity types on site.
// We can't set empty array because of check in AddressFormat.php, line 128.
$definition['required_fields'] = [
'givenName',
];
$event
->setDefinition($definition);
}
}
Classes
Name | Description |
---|---|
AddressFormatSubscriber | Class AddressFormatSubscriber. |