-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.php
60 lines (52 loc) · 1.78 KB
/
controller.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Concrete\Package\SecretPreviewUrl;
use Concrete\Core\Application\Service\UserInterface\Menu;
use Concrete\Core\Package\Package;
use Concrete\Core\Routing\Router;
use Concrete\Core\Routing\RouterInterface;
class Controller extends Package
{
protected $appVersionRequired = '8.5.0';
protected $pkgHandle = 'secret_preview_url';
protected $pkgVersion = '0.9.0';
protected $pkgAutoloaderRegistries = [
'src' => '\Concrete5cojp\SecretPreviewUrl',
];
public function getPackageName()
{
return t('Secret Preview URL');
}
public function getPackageDescription()
{
return t('Get the link for sharing unpublished pages.');
}
public function on_start()
{
/** @var Router $router */
$router = $this->app->make(RouterInterface::class);
$router->buildGroup()
->setPrefix('/ccm/secret_preview_url')
->setNamespace('Concrete\Package\SecretPreviewUrl\Controller')
->routes('secret_preview_url.php', $this->getPackageHandle());
/** @var Menu $menu */
$menu = $this->app->make('helper/concrete/ui/menu');
$menu->addPageHeaderMenuItem('secret_preview_url', $this->getPackageHandle(), [
'icon' => 'user-secret',
'label' => t('Secret Preview URL'),
'position' => 'left',
'linkAttributes' => [
'class' => 'dialog-launch',
'dialog-width' => 620,
'dialog-height' => 480,
'dialog-modal' => true,
'dialog-title' => t('Secret Preview URL'),
],
]);
}
public function install()
{
$pkg = parent::install();
$this->installContentFile('config/singlepages.xml');
return $pkg;
}
}