class ContentEntityTestAlterSubscriber in Replication 8
Same name and namespace in other branches
- 8.2 tests/modules/replication_alter_test/src/Event/ContentEntityTestAlterSubscriber.php \Drupal\replication_alter_test\Event\ContentEntityTestAlterSubscriber
Event subscriber to test altering data during normalization.
Hierarchy
- class \Drupal\replication_alter_test\Event\ContentEntityTestAlterSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ContentEntityTestAlterSubscriber
1 string reference to 'ContentEntityTestAlterSubscriber'
- replication_alter_test.services.yml in tests/
modules/ replication_alter_test/ replication_alter_test.services.yml - tests/modules/replication_alter_test/replication_alter_test.services.yml
1 service uses ContentEntityTestAlterSubscriber
- replication_alter_test.content.subscriber in tests/
modules/ replication_alter_test/ replication_alter_test.services.yml - Drupal\replication_alter_test\Event\ContentEntityTestAlterSubscriber
File
- tests/
modules/ replication_alter_test/ src/ Event/ ContentEntityTestAlterSubscriber.php, line 13
Namespace
Drupal\replication_alter_test\EventView source
class ContentEntityTestAlterSubscriber implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events = [];
$events[ReplicationDataEvents::ALTER_CONTENT_DATA][] = [
'onAlterContentData',
0,
];
return $events;
}
/**
* Alter content normalization data.
*
* @param ReplicationContentDataAlterEvent $event
*/
public function onAlterContentData(ReplicationContentDataAlterEvent $event) {
// Add some data under a '_test' key.
$normalized = $event
->getData();
$normalized['_test'] = [
'foo' => 'bar',
];
$event
->setData($normalized);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentEntityTestAlterSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
ContentEntityTestAlterSubscriber:: |
public | function | Alter content normalization data. |