-
Notifications
You must be signed in to change notification settings - Fork 1
/
OverviewBuilder.php
68 lines (56 loc) · 1.45 KB
/
OverviewBuilder.php
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
<?php
namespace Drupal\wmentity_overview\Annotation;
use Drupal\Component\Annotation\Plugin;
/**
* @Annotation
*/
class OverviewBuilder extends Plugin
{
public const TYPE_CUSTOM = 'custom';
public const TYPE_ENTITY_OVERRIDE = 'entity';
public const TYPE_ROUTE_OVERRIDE = 'route';
/** @var string */
public $entity_type;
/** @var bool */
public $override = false;
/** @var string */
public $bundle;
/** @var string */
public $route_name;
/** @var string */
public $id;
/** @var array */
public $filters = [];
/** @var string */
public $filter_storage = 'query_param';
public function getType(): string
{
if (isset($this->definition['override'])) {
return self::TYPE_ENTITY_OVERRIDE;
}
if (isset($this->definition['route_name'])) {
return self::TYPE_ROUTE_OVERRIDE;
}
return self::TYPE_CUSTOM;
}
public function getEntityTypeId(): string
{
return $this->definition['entity_type'];
}
public function getRouteName(): ?string
{
return $this->definition['route_name'] ?? null;
}
public function getFilters(): array
{
return $this->definition['filters'];
}
public function getFilterStorageId(): string
{
return $this->definition['filter_storage'];
}
public function isOverride(): bool
{
return $this->definition['override'];
}
}