|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\entities\routing\handlers\admin; |
|
4
|
|
|
|
|
5
|
|
|
use EE_Dependency_Map; |
|
6
|
|
|
use EventEspresso\core\domain\services\assets\EspressoEditorAssetManager; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class EspressoEventEditor |
|
10
|
|
|
* detects and executes logic for the Event Espresso Event Editor |
|
11
|
|
|
* |
|
12
|
|
|
* @package EventEspresso\core\domain\entities\routing\admin |
|
13
|
|
|
* @author Brent Christensen |
|
14
|
|
|
* @since $VID:$ |
|
15
|
|
|
*/ |
|
16
|
|
|
class EspressoEventEditor extends EspressoEventsAdmin |
|
17
|
|
|
{ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @var EspressoEditorAssetManager $asset_manager |
|
21
|
|
|
*/ |
|
22
|
|
|
protected $asset_manager; |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* returns true if the current request matches this route |
|
27
|
|
|
* |
|
28
|
|
|
* @return bool |
|
29
|
|
|
* @since $VID:$ |
|
30
|
|
|
*/ |
|
31
|
|
|
public function matchesCurrentRequest() |
|
32
|
|
|
{ |
|
33
|
|
|
return parent::matchesCurrentRequest() |
|
34
|
|
|
&& $this->admin_config->useAdvancedEditor() |
|
35
|
|
|
&& ( |
|
36
|
|
|
$this->request->getRequestParam('action') === 'create_new' |
|
37
|
|
|
|| $this->request->getRequestParam('action') === 'edit' |
|
38
|
|
|
); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @since $VID:$ |
|
44
|
|
|
*/ |
|
45
|
|
|
protected function registerDependencies() |
|
46
|
|
|
{ |
|
47
|
|
|
$this->dependency_map->registerDependencies( |
|
48
|
|
|
'EventEspresso\core\domain\services\assets\EspressoEditorAssetManager', |
|
49
|
|
|
[ |
|
50
|
|
|
'EventEspresso\core\domain\Domain' => EE_Dependency_Map::load_from_cache, |
|
51
|
|
|
'EventEspresso\core\services\assets\AssetCollection' => EE_Dependency_Map::load_from_cache, |
|
52
|
|
|
'EventEspresso\core\services\assets\Registry' => EE_Dependency_Map::load_from_cache, |
|
53
|
|
|
] |
|
54
|
|
|
); |
|
55
|
|
|
$this->dependency_map->registerDependencies( |
|
56
|
|
|
'EventEspresso\core\domain\services\admin\events\editor\EventEditor', |
|
57
|
|
|
[ |
|
58
|
|
|
'EE_Admin_Config' => EE_Dependency_Map::load_from_cache, |
|
59
|
|
|
'EE_Event' => EE_Dependency_Map::not_registered, |
|
60
|
|
|
'EventEspresso\core\domain\entities\admin\GraphQLData\CurrentUser' => |
|
61
|
|
|
EE_Dependency_Map::not_registered, |
|
62
|
|
|
'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData' => |
|
63
|
|
|
EE_Dependency_Map::load_from_cache, |
|
64
|
|
|
'EventEspresso\core\domain\entities\admin\GraphQLData\GeneralSettings' => |
|
65
|
|
|
EE_Dependency_Map::load_from_cache, |
|
66
|
|
|
'EventEspresso\core\services\assets\JedLocaleData' => EE_Dependency_Map::load_from_cache, |
|
67
|
|
|
] |
|
68
|
|
|
); |
|
69
|
|
|
$this->dependency_map->registerDependencies( |
|
70
|
|
|
'EventEspresso\core\domain\services\admin\events\editor\EventEditorGraphQLData', |
|
71
|
|
|
[ |
|
72
|
|
|
'EventEspresso\core\domain\entities\admin\GraphQLData\Datetimes' => EE_Dependency_Map::load_from_cache, |
|
73
|
|
|
'EventEspresso\core\domain\entities\admin\GraphQLData\Prices' => EE_Dependency_Map::load_from_cache, |
|
74
|
|
|
'EventEspresso\core\domain\entities\admin\GraphQLData\PriceTypes' => EE_Dependency_Map::load_from_cache, |
|
75
|
|
|
'EventEspresso\core\domain\entities\admin\GraphQLData\Tickets' => EE_Dependency_Map::load_from_cache, |
|
76
|
|
|
'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities' => EE_Dependency_Map::load_from_cache, |
|
77
|
|
|
'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations' => EE_Dependency_Map::load_from_cache, |
|
78
|
|
|
] |
|
79
|
|
|
); |
|
80
|
|
|
$this->dependency_map->registerDependencies( |
|
81
|
|
|
'EventEspresso\core\domain\services\admin\events\editor\EventEntityRelations', |
|
82
|
|
|
[ |
|
83
|
|
|
'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
84
|
|
|
'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
85
|
|
|
'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
86
|
|
|
'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
87
|
|
|
'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
88
|
|
|
] |
|
89
|
|
|
); |
|
90
|
|
|
$this->dependency_map->registerDependencies( |
|
91
|
|
|
'EventEspresso\core\domain\services\admin\events\editor\NewEventDefaultEntities', |
|
92
|
|
|
[ |
|
93
|
|
|
'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
94
|
|
|
'EEM_Event' => EE_Dependency_Map::load_from_cache, |
|
95
|
|
|
'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
96
|
|
|
'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
97
|
|
|
'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
98
|
|
|
'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes' => EE_Dependency_Map::load_from_cache, |
|
99
|
|
|
] |
|
100
|
|
|
); |
|
101
|
|
|
$this->dependency_map->registerDependencies( |
|
102
|
|
|
'EventEspresso\core\domain\services\admin\entities\DefaultDatetimes', |
|
103
|
|
|
[ |
|
104
|
|
|
'EventEspresso\core\domain\services\admin\entities\DefaultTickets' => EE_Dependency_Map::load_from_cache, |
|
105
|
|
|
'EEM_Datetime' => EE_Dependency_Map::load_from_cache, |
|
106
|
|
|
] |
|
107
|
|
|
); |
|
108
|
|
|
$this->dependency_map->registerDependencies( |
|
109
|
|
|
'EventEspresso\core\domain\services\admin\entities\DefaultTickets', |
|
110
|
|
|
[ |
|
111
|
|
|
'EventEspresso\core\domain\services\admin\entities\DefaultPrices' => EE_Dependency_Map::load_from_cache, |
|
112
|
|
|
'EEM_Ticket' => EE_Dependency_Map::load_from_cache, |
|
113
|
|
|
] |
|
114
|
|
|
); |
|
115
|
|
|
$this->dependency_map->registerDependencies( |
|
116
|
|
|
'EventEspresso\core\domain\services\admin\entities\DefaultPrices', |
|
117
|
|
|
[ |
|
118
|
|
|
'EEM_Price' => EE_Dependency_Map::load_from_cache, |
|
119
|
|
|
'EEM_Price_Type' => EE_Dependency_Map::load_from_cache, |
|
120
|
|
|
] |
|
121
|
|
|
); |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* implements logic required to run during request |
|
127
|
|
|
* |
|
128
|
|
|
* @return bool |
|
129
|
|
|
* @since $VID:$ |
|
130
|
|
|
*/ |
|
131
|
|
|
protected function requestHandler() |
|
132
|
|
|
{ |
|
133
|
|
|
$this->asset_manager = $this->loader->getShared( |
|
134
|
|
|
'EventEspresso\core\domain\services\assets\EspressoEditorAssetManager' |
|
135
|
|
|
); |
|
136
|
|
|
add_action('admin_enqueue_scripts', [$this, 'enqueueEspressoEditorAssets'], 100); |
|
137
|
|
|
return false; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* enqueue_scripts - Load the scripts and css |
|
143
|
|
|
* |
|
144
|
|
|
* @return void |
|
145
|
|
|
*/ |
|
146
|
|
|
public function enqueueEspressoEditorAssets() |
|
147
|
|
|
{ |
|
148
|
|
|
$this->asset_manager->enqueueBrowserAssets(); |
|
149
|
|
|
} |
|
150
|
|
|
} |
|
151
|
|
|
|