Addon.php
1.38 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
<?php
namespace ACP\Export;
use AC\Asset\Location;
use AC\ListScreenRepository\Storage;
use AC\Registerable;
use AC\Services;
use ACP\RequestAjaxHandlers;
use ACP\RequestAjaxParser;
class Addon implements Registerable
{
private $location;
private $list_screen_repository;
public function __construct(
Location\Absolute $location,
Storage $list_screen_repository
) {
$this->location = $location;
$this->list_screen_repository = $list_screen_repository;
}
public function register(): void
{
$this->create_services()->register();
}
private function create_services(): Services
{
$request_ajax_handlers = new RequestAjaxHandlers();
$request_ajax_handlers->add(
'acp-export-file-name',
new RequestHandler\Ajax\FileName($this->list_screen_repository)
);
$request_ajax_handlers->add(
'acp-export-order-preference',
new RequestHandler\Ajax\SaveExportPreference()
);
$request_ajax_handlers->add(
'acp-export-show-export-button',
new RequestHandler\Ajax\ToggleExportButtonTable()
);
return new Services([
new Admin(),
new RequestAjaxParser($request_ajax_handlers),
new Settings($this->location),
new TableScreen($this->location),
]);
}
}