You are here

public function ContentEntityTestAlterSubscriber::onAlterContentData in Replication 8

Same name and namespace in other branches
  1. 8.2 tests/modules/replication_alter_test/src/Event/ContentEntityTestAlterSubscriber.php \Drupal\replication_alter_test\Event\ContentEntityTestAlterSubscriber::onAlterContentData()

Alter content normalization data.

Parameters

ReplicationContentDataAlterEvent $event:

File

tests/modules/replication_alter_test/src/Event/ContentEntityTestAlterSubscriber.php, line 29

Class

ContentEntityTestAlterSubscriber
Event subscriber to test altering data during normalization.

Namespace

Drupal\replication_alter_test\Event

Code

public function onAlterContentData(ReplicationContentDataAlterEvent $event) {

  // Add some data under a '_test' key.
  $normalized = $event
    ->getData();
  $normalized['_test'] = [
    'foo' => 'bar',
  ];
  $event
    ->setData($normalized);
}