Skip to content

Commit

Permalink
Merge pull request #67 from in2code-de/feature/luxletter-link-event
Browse files Browse the repository at this point in the history
Add event listener to handle LuxletterLinkLuxIdentificationEvent
  • Loading branch information
einpraegsam authored Feb 18, 2025
2 parents 927e602 + 65f03a8 commit 447e120
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Classes/Hooks/LuxletterLinkLuxIdentificationHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);
namespace In2code\Lux\Hooks;

use In2code\Lux\Utility\CookieUtility;
use In2code\Luxletter\Events\LuxletterLinkLuxIdentificationEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

#[AsEventListener(
identifier: 'lux/handle-luxletter-link-lux-identification',
event: LuxletterLinkLuxIdentificationEvent::class
)]
class LuxletterLinkLuxIdentificationHandler
{
public function __invoke(LuxletterLinkLuxIdentificationEvent $event)
{
if ($event->isIdentification()) {
$link = $event->getLink();
CookieUtility::setCookie('luxletterlinkhash', $link['hash']);
}
}
}

0 comments on commit 447e120

Please sign in to comment.