1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the TYPO3 CMS project. |
7
|
|
|
* |
8
|
|
|
* It is free software; you can redistribute it and/or modify it under |
9
|
|
|
* the terms of the GNU General Public License, either version 2 |
10
|
|
|
* of the License, or any later version. |
11
|
|
|
* |
12
|
|
|
* For the full copyright and license information, please read the |
13
|
|
|
* LICENSE.txt file that was distributed with this source code. |
14
|
|
|
* |
15
|
|
|
* The TYPO3 project - inspiring people to share! |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
namespace TYPO3\CMS\Workspaces\Event; |
19
|
|
|
|
20
|
|
|
use Psr\EventDispatcher\StoppableEventInterface; |
21
|
|
|
use Psr\Http\Message\UriInterface; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Used to generate or adjust preview URLs being shown in workspaces backend module. |
25
|
|
|
*/ |
26
|
|
|
final class RetrievedPreviewUrlEvent implements StoppableEventInterface |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
private $tableName; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var int |
35
|
|
|
*/ |
36
|
|
|
private $uid; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var UriInterface|null |
40
|
|
|
*/ |
41
|
|
|
private $previewUri; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var array |
45
|
|
|
*/ |
46
|
|
|
private $contextData; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var bool |
50
|
|
|
*/ |
51
|
|
|
private $stopped = false; |
52
|
|
|
|
53
|
|
|
public function __construct(string $tableName, int $uid, ?UriInterface $previewUri, array $contextData) |
54
|
|
|
{ |
55
|
|
|
$this->tableName = $tableName; |
56
|
|
|
$this->uid = $uid; |
57
|
|
|
$this->previewUri = $previewUri; |
58
|
|
|
$this->contextData = $contextData; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function stop(): void |
62
|
|
|
{ |
63
|
|
|
$this->stopped = true; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function isPropagationStopped(): bool |
67
|
|
|
{ |
68
|
|
|
return $this->stopped; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return UriInterface|null |
73
|
|
|
*/ |
74
|
|
|
public function getPreviewUri(): ?UriInterface |
75
|
|
|
{ |
76
|
|
|
return $this->previewUri; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param UriInterface $previewUri |
81
|
|
|
*/ |
82
|
|
|
public function setPreviewUri(UriInterface $previewUri): void |
83
|
|
|
{ |
84
|
|
|
$this->previewUri = $previewUri; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return string |
89
|
|
|
*/ |
90
|
|
|
public function getTableName(): string |
91
|
|
|
{ |
92
|
|
|
return $this->tableName; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @return int |
97
|
|
|
*/ |
98
|
|
|
public function getUid(): int |
99
|
|
|
{ |
100
|
|
|
return $this->uid; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @return array |
105
|
|
|
*/ |
106
|
|
|
public function getContextData(): array |
107
|
|
|
{ |
108
|
|
|
return $this->contextData; |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|