forked from EC-CUBE/maker-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakerEvent.php
121 lines (112 loc) · 3.08 KB
/
MakerEvent.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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/*
* This file is part of the Maker plugin
*
* Copyright (C) 2016 LOCKON CO.,LTD. All Rights Reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Plugin\Maker;
use Eccube\Application;
use Eccube\Event\EventArgs;
use Eccube\Event\TemplateEvent;
use Plugin\Maker\Event\Maker;
use Plugin\Maker\Event\MakerLegacy;
use Plugin\Maker\Util\Version;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
/**
* Class MakerEvent.
*/
class MakerEvent
{
/**
* @var Application
*/
private $app;
/**
* MakerEvent constructor.
* @param Application $app
*/
public function __construct($app)
{
$this->app = $app;
}
/**
* New event function on version >= 3.0.9 (new hook point).
* Add/Edit product render trigger.
*
* @param EventArgs $event
*/
public function onAdminProductEditInitialize(EventArgs $event)
{
/* @var Maker $makerEvent */
$makerEvent = $this->app['eccube.plugin.maker.event.maker'];
$makerEvent->onAdminProductEditInitialize($event);
}
/**
* New Event:function on version >= 3.0.9 (new hook point).
* Save event.
*
* @param EventArgs $event
*/
public function onAdminProductEditComplete(EventArgs $event)
{
/* @var Maker $makerEvent */
$makerEvent = $this->app['eccube.plugin.maker.event.maker'];
$makerEvent->onAdminProductEditComplete($event);
}
/**
* New event function on version >= 3.0.9 (new hook point)
* Product detail render (front).
*
* @param TemplateEvent $event
*/
public function onRenderProductDetail(TemplateEvent $event)
{
/* @var Maker $makerEvent */
$makerEvent = $this->app['eccube.plugin.maker.event.maker'];
$makerEvent->onRenderProductDetail($event);
}
/**
* Add product trigger.
*
* @param FilterResponseEvent $event
*
* @deprecated for since v3.0.0, to be removed in 3.1
*/
public function onRenderAdminProduct(FilterResponseEvent $event)
{
if ($this->supportNewHookPoint()) {
return;
}
/* @var MakerLegacy $makerEvent */
$makerEvent = $this->app['eccube.plugin.maker.event.maker_legacy'];
$makerEvent->onRenderAdminProduct($event);
}
/**
* Product detail render (front).
*
* @param FilterResponseEvent $event
*
* @deprecated for since v3.0.0, to be removed in 3.1
*/
public function onRenderProductDetailBefore(FilterResponseEvent $event)
{
if ($this->supportNewHookPoint()) {
return;
}
/* @var MakerLegacy $makerEvent */
$makerEvent = $this->app['eccube.plugin.maker.event.maker_legacy'];
$makerEvent->onRenderProductDetailBefore($event);
}
/**
* v3.0.9以降のフックポイントに対応しているのか.
*
* @return bool
*/
private function supportNewHookPoint()
{
return Version::isSupport();
}
}