forked from EC-CUBE/TwoFactorAuthCustomerSms42
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEvent.php
More file actions
108 lines (95 loc) · 2.74 KB
/
Copy pathEvent.php
File metadata and controls
108 lines (95 loc) · 2.74 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
*
* http://www.ec-cube.co.jp/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Plugin\TwoFactorAuthCustomerSms42;
use Eccube\Entity\BaseInfo;
use Eccube\Repository\BaseInfoRepository;
use Doctrine\ORM\EntityManagerInterface;
use Eccube\Event\EccubeEvents;
use Eccube\Event\EventArgs;
use Eccube\Event\TemplateEvent;
use Eccube\Request\Context;
use Plugin\TwoFactorAuthCustomer42\Repository\BaseTwoFactorAuthSettingRepository;
use Plugin\TwoFactorAuthCustomer42\Service\CustomerTwoFactorAuthService;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Filesystem\Filesystem;
/**
* Class Event.
*/
class Event implements EventSubscriberInterface
{
/**
* @var ContainerInterface
*/
protected $container;
/**
* @var BaseInfo
*/
protected $BaseInfo;
/**
* @var CustomerTwoFactorAuthService
*/
protected $customerTwoFactorAuthService;
/**
* @var EntityManagerInterface
*/
private $entityManager;
/**
* @var \Twig_Environment
*/
private $twig;
/**
* @var NotifierInterface
*/
//private $notifier;
/**
* Event constructor.
*
* @param ContainerInterface $container
* @param BaseInfoRepository $baseInfoRepository
* @param EntityManagerInterface $entityManager
* @param CustomerTwoFactorAuthService $customerTwoFactorAuthService
* @param \Twig_Environment $twig
*/
public function __construct(
ContainerInterface $container,
BaseInfoRepository $baseInfoRepository,
EntityManagerInterface $entityManager,
CustomerTwoFactorAuthService $customerTwoFactorAuthService,
\Twig_Environment $twig
)
{
$this->container = $container;
$this->BaseInfo = $baseInfoRepository->get();
$this->entityManager = $entityManager;
$this->customerTwoFactorAuthService = $customerTwoFactorAuthService;
$this->twig = $twig;
}
public static function getSubscribedEvents(): array
{
return [
'@admin/Customer/edit.twig' => 'onRenderAdminCustomerEdit',
];
}
/**
* [/admin/customer/edit]表示の時のEvent Fork.
* 二段階認証関連項目を追加する.
*
* @param TemplateEvent $event
*/
public function onRenderAdminCustomerEdit(TemplateEvent $event)
{
// add twig
$twig = 'TwoFactorAuthCustomerSms42/Resource/template/admin/customer_edit.twig';
$event->addSnippet($twig);
}
}