1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace LAG\AdminBundle\Metadata; |
6
|
|
|
|
7
|
|
|
class Link |
8
|
|
|
{ |
9
|
|
|
public function __construct( |
10
|
|
|
private ?string $route = null, |
11
|
|
|
private array $routeParameters = [], |
12
|
|
|
private ?string $resourceName = null, |
13
|
|
|
private ?string $operationName = null, |
14
|
|
|
private ?string $template = '@LAGAdmin/grid/actions/button.html.twig', |
15
|
|
|
private ?string $label = null, |
16
|
|
|
private ?string $type = null, |
17
|
|
|
private ?string $url = null, |
18
|
|
|
private ?string $icon = null, |
19
|
|
|
) { |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function getResourceName(): ?string |
23
|
|
|
{ |
24
|
|
|
return $this->resourceName; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function withResourceName(?string $resourceName): self |
28
|
|
|
{ |
29
|
|
|
$self = clone $this; |
30
|
|
|
$self->resourceName = $resourceName; |
31
|
|
|
|
32
|
|
|
return $self; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function getRoute(): ?string |
36
|
|
|
{ |
37
|
|
|
return $this->route; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function withName(?string $routeName): self |
41
|
|
|
{ |
42
|
|
|
$self = clone $this; |
43
|
|
|
$self->route = $routeName; |
44
|
|
|
|
45
|
|
|
return $self; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
public function getRouteParameters(): array |
49
|
|
|
{ |
50
|
|
|
return $this->routeParameters; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function withRouteParameters(array $routeParameters): self |
54
|
|
|
{ |
55
|
|
|
$self = clone $this; |
56
|
|
|
$self->routeParameters = $routeParameters; |
57
|
|
|
|
58
|
|
|
return $self; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function getOperationName(): ?string |
62
|
|
|
{ |
63
|
|
|
return $this->operationName; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function withOperationName(?string $operationName): self |
67
|
|
|
{ |
68
|
|
|
$self = clone $this; |
69
|
|
|
$self->operationName = $operationName; |
70
|
|
|
|
71
|
|
|
return $self; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getTemplate(): ?string |
75
|
|
|
{ |
76
|
|
|
return $this->template; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function withTemplate(?string $template): self |
80
|
|
|
{ |
81
|
|
|
$self = clone $this; |
82
|
|
|
$self->template = $template; |
83
|
|
|
|
84
|
|
|
return $self; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
public function getLabel(): ?string |
88
|
|
|
{ |
89
|
|
|
return $this->label; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
public function withLabel(?string $label): self |
93
|
|
|
{ |
94
|
|
|
$self = clone $this; |
95
|
|
|
$self->label = $label; |
96
|
|
|
|
97
|
|
|
return $self; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function getType(): ?string |
101
|
|
|
{ |
102
|
|
|
return $this->type; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function withType(?string $type): self |
106
|
|
|
{ |
107
|
|
|
$self = clone $this; |
108
|
|
|
$self->type = $type; |
109
|
|
|
|
110
|
|
|
return $self; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function getUrl(): ?string |
114
|
|
|
{ |
115
|
|
|
return $this->url; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function withUrl(?string $url): self |
119
|
|
|
{ |
120
|
|
|
$self = clone $this; |
121
|
|
|
$self->url = $url; |
122
|
|
|
|
123
|
|
|
return $self; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
public function getIcon(): ?string |
127
|
|
|
{ |
128
|
|
|
return $this->icon; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function withIcon(?string $icon): self |
132
|
|
|
{ |
133
|
|
|
$self = clone $this; |
134
|
|
|
$self->icon = $icon; |
135
|
|
|
|
136
|
|
|
return $self; |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
|