Addon.php
1.17 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
<?php
namespace ACP\QuickAdd;
use AC;
use AC\Asset\Location;
use AC\ListScreenRepository\Storage;
use AC\Services;
use ACP\QuickAdd\Admin\HideOnScreen;
use ACP\QuickAdd\Model\Factory;
use ACP\QuickAdd\Model\PostFactory;
class Addon implements AC\Registerable
{
private $storage;
private $location;
private $request;
public function __construct(Storage $storage, Location\Absolute $location, AC\Request $request)
{
$this->storage = $storage;
$this->location = $location;
$this->request = $request;
}
public function register(): void
{
Factory::add_factory(new PostFactory());
$this->create_services()
->register();
}
private function create_services(): Services
{
$preference = new Table\Preference\ShowButton();
$filter = new Filter();
return new Services([
new Controller\AjaxNewItem($this->storage, $this->request),
new Controller\AjaxScreenOption($this->storage, $preference),
new Table\Loader($this->location, new HideOnScreen\QuickAdd(), $preference, $filter),
new Admin\Settings($filter),
]);
}
}