-
Notifications
You must be signed in to change notification settings - Fork 145
Expand file tree
/
Copy pathStandaloneInteractionContextMenuView.class.php
More file actions
40 lines (34 loc) · 1.2 KB
/
StandaloneInteractionContextMenuView.class.php
File metadata and controls
40 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace wcf\system\interaction;
use wcf\data\DatabaseObject;
use wcf\system\WCF;
class StandaloneInteractionContextMenuView extends InteractionContextMenuView
{
public function __construct(
IInteractionProvider $provider,
protected readonly DatabaseObject $object,
protected readonly string $redirectUrl
) {
parent::__construct($provider);
}
public function render(): string
{
return WCF::getTPL()->render(
'wcf',
'shared_standaloneInteractionButton',
[
'contextMenuOptions' => $this->renderContextMenuOptions($this->object),
'initializationCode' => $this->renderInitialization($this->getContainerID()),
'containerID' => $this->getContainerID(),
'providerClassName' => \get_class($this->provider),
'objectID' => $this->object->getObjectID(),
'redirectUrl' => $this->redirectUrl,
],
);
}
public function getContainerID(): string
{
$classNamePieces = \explode('\\', \get_class($this->object));
return \implode('-', $classNamePieces) . '-' . $this->object->getObjectID();
}
}