-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShopwareShortcuts.php
69 lines (51 loc) · 1.78 KB
/
ShopwareShortcuts.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
61
62
63
64
65
66
67
68
69
<?php
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <[email protected]> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Uli Ehler
* ----------------------------------------------------------------------------
*/
namespace ShopwareShortcuts;
use Shopware\Components\Plugin;
class ShopwareShortcuts extends Plugin
{
public static function getSubscribedEvents(): array
{
return [
'Enlight_Controller_Action_PostDispatchSecure_Backend' => 'onBackendIndex',
];
}
public function onBackendIndex(\Enlight_Controller_ActionEventArgs $args): void
{
$view = $args->getSubject()->View();
$view->addTemplateDir($this->getPath() . '/Resources/views/extjs');
$view->extendsTemplate('backend/shopware_shortcuts/controller/main.js');
}
public function install(Plugin\Context\InstallContext $context): void
{
}
public function update(Plugin\Context\UpdateContext $context): void
{
$this->clearBackendCache($context);
}
public function activate(Plugin\Context\ActivateContext $context): void
{
$this->clearBackendCache($context);
}
public function deactivate(Plugin\Context\DeactivateContext $context): void
{
$this->clearBackendCache($context);
}
public function uninstall(Plugin\Context\UninstallContext $context): void
{
$this->clearBackendCache($context);
}
private function clearBackendCache(Plugin\Context\InstallContext $context): void
{
$context->scheduleClearCache([
'backend',
]);
}
}