diff --git a/modules/eca/src/Plugin/ECA/Event/ChannelEvent.php b/modules/eca/src/Plugin/ECA/Event/ChannelEvent.php index 56ec824800044f0896aebb4c96cc5086f1e626c7..624b807fd2c83a60518e9c6f29c00e0dec6d8320 100644 --- a/modules/eca/src/Plugin/ECA/Event/ChannelEvent.php +++ b/modules/eca/src/Plugin/ECA/Event/ChannelEvent.php @@ -52,19 +52,18 @@ class ChannelEvent extends EventBase { /** * {@inheritdoc} */ - protected function buildEventData(): array { + public function getData(string $key): mixed { $event = $this->getEvent(); - $data = []; - if ($event instanceof ChannelEventBase) { - $data['push_notification'] = [ + if ($key === 'push_notification' && $event instanceof ChannelEventBase) { + $data = [ 'channel' => $event->getChannelPlugin()->getPluginId(), 'recipient' => $event->getUser(), 'entity' => $event->getEntity(), 'display_mode' => $event->getDisplayMode(), ]; if ($event instanceof ChannelPrepareTemplates) { - $data['push_notification'] += [ + $data += [ 'subject' => $event->getSubject(), 'body' => $event->getBody(), 'text_format' => $event->getTextFormat(), @@ -72,24 +71,24 @@ class ChannelEvent extends EventBase { ]; } if ($event instanceof ChannelEventLanguageBase) { - $data['push_notification'] += [ + $data += [ 'language_key' => $event->getLanguageKey(), ]; } if ($event instanceof ChannelPreRender) { - $data['push_notification'] += [ + $data += [ 'elements' => $event->getElements(), ]; } if ($event instanceof ChannelPostRender) { - $data['push_notification'] += [ + $data += [ 'output' => $event->getOutput(), ]; } + return $data; } - $data += parent::buildEventData(); - return $data; + return parent::getData($key); } }