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