|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* Copyright (C) |
|
6
|
|
|
* Nathan Boiron <[email protected]> |
|
7
|
|
|
* Romain Canon <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* This file is part of the TYPO3 NotiZ project. |
|
10
|
|
|
* It is free software; you can redistribute it and/or modify it |
|
11
|
|
|
* under the terms of the GNU General Public License, either |
|
12
|
|
|
* version 3 of the License, or any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* For the full copyright and license information, see: |
|
15
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace CuyZ\Notiz\Controller\Backend\Manager\Notification; |
|
19
|
|
|
|
|
20
|
|
|
use CuyZ\Notiz\Core\Event\Support\ProvidesExampleProperties; |
|
21
|
|
|
use CuyZ\Notiz\Domain\Notification\Slack\Application\EntitySlack\EntitySlackNotification; |
|
22
|
|
|
use CuyZ\Notiz\Domain\Notification\Slack\Application\EntitySlack\Service\EntitySlackMessageBuilder; |
|
23
|
|
|
use CuyZ\Notiz\Domain\Notification\Slack\SlackNotification; |
|
24
|
|
|
|
|
25
|
|
|
class ShowEntitySlackController extends ShowNotificationController |
|
26
|
|
|
{ |
|
27
|
|
|
/** |
|
28
|
|
|
* @var SlackNotification |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $notification; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @inheritdoc |
|
34
|
|
|
*/ |
|
35
|
|
|
public function showAction() |
|
36
|
|
|
{ |
|
37
|
|
|
parent::showAction(); |
|
38
|
|
|
|
|
39
|
|
|
$message = $this->notification->getMessage(); |
|
40
|
|
|
|
|
41
|
|
|
if ($this->notification->hasEventDefinition()) { |
|
42
|
|
|
$payload = $this->getPreviewPayload(); |
|
43
|
|
|
|
|
44
|
|
|
if ($payload->getEvent() instanceof ProvidesExampleProperties) { |
|
45
|
|
|
$builder = $this->objectManager->get(EntitySlackMessageBuilder::class, $payload); |
|
46
|
|
|
$message = $builder->getMessage(); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
$this->view->assign('message', $message); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @return string |
|
55
|
|
|
*/ |
|
56
|
|
|
public function getNotificationDefinitionIdentifier(): string |
|
57
|
|
|
{ |
|
58
|
|
|
return EntitySlackNotification::getDefinitionIdentifier(); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|