AdvancedCustomFields.php
2.29 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
declare(strict_types=1);
namespace ACA\ACF;
use AC;
use AC\ListScreenRepository\Storage;
use AC\Registerable;
use AC\Request;
use AC\Services;
use AC\Vendor\Psr\Container\ContainerInterface;
use ACA\ACF\ConditionalFormatting\FieldFormattableFactory;
use ACA\ACF\ListScreenFactory\FieldGroupFactory;
use ACA\ACF\RequestHandler\MapLegacyListScreen;
use ACP\RequestHandlerFactory;
use ACP\RequestParser;
use ACP\Service\IntegrationStatus;
final class AdvancedCustomFields implements Registerable
{
private $location;
private $container;
public function __construct(AC\Asset\Location\Absolute $location, ContainerInterface $container)
{
$this->location = $location;
$this->container = $container;
}
public function register(): void
{
if ( ! class_exists('acf', false)) {
return;
}
AC\ListScreenFactory\Aggregate::add(new FieldGroupFactory());
$this->create_services()->register();
}
private function create_services(): Services
{
$column_initiator = new ColumnInstantiator(
new ConfigFactory(new FieldFactory()),
new Search\ComparisonFactory(),
new Sorting\ModelFactory(),
new Editing\ModelFactory(),
new Filtering\ModelFactory(),
new FieldFormattableFactory()
);
$request_handler_factory = new RequestHandlerFactory(new Request());
$request_handler_factory->add(
'aca-acf-map-legacy-list-screen',
new MapLegacyListScreen($this->container->get(Storage::class))
);
return new Services([
new IntegrationStatus('ac-addon-acf'),
new ColumnGroup(),
new Service\ColumnSettings(),
new Service\EditingFix(),
new Service\LegacyColumnMapper(),
new Service\ListScreens(),
new Service\RemoveDeprecatedColumnFromTypeSelector(),
new Service\AddColumns(
new FieldRepository(new FieldGroup\QueryFactory()),
new FieldsFactory(),
new ColumnFactory($column_initiator)
),
new Service\Scripts($this->location),
new Service\InitColumn($column_initiator),
new RequestParser($request_handler_factory),
]);
}
}