forked from drupal/drupal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSectionStorageInterface.php
More file actions
179 lines (162 loc) · 5.16 KB
/
SectionStorageInterface.php
File metadata and controls
179 lines (162 loc) · 5.16 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
namespace Drupal\layout_builder;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Access\AccessibleInterface;
use Drupal\Core\Plugin\ContextAwarePluginInterface;
use Symfony\Component\Routing\RouteCollection;
/**
* Defines an interface for Section Storage type plugins.
*
* @internal
* Layout Builder is currently experimental and should only be leveraged by
* experimental modules and development releases of contributed modules.
* See https://www.drupal.org/core/experimental for more information.
*
* @todo Remove AccessibleInterface
*/
interface SectionStorageInterface extends SectionListInterface, PluginInspectionInterface, ContextAwarePluginInterface, AccessibleInterface {
/**
* Returns an identifier for this storage.
*
* @return string
* The unique identifier for this storage.
*/
public function getStorageId();
/**
* Returns the type of this storage.
*
* Used in conjunction with the storage ID.
*
* @return string
* The type of storage.
*/
public function getStorageType();
/**
* Derives the section list from the storage ID.
*
* @param string $id
* The storage ID, see ::getStorageId().
*
* @return \Drupal\layout_builder\SectionListInterface
* The section list.
*
* @throws \InvalidArgumentException
* Thrown if the ID is invalid.
*
* @internal
* This should only be called during section storage instantiation.
*
* @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. The
* section list should be derived from context. See
* https://www.drupal.org/node/3016262.
*/
public function getSectionListFromId($id);
/**
* Provides the routes needed for Layout Builder UI.
*
* Allows the plugin to add or alter routes during the route building process.
* \Drupal\layout_builder\Routing\LayoutBuilderRoutesTrait is provided for the
* typical use case of building a standard Layout Builder UI.
*
* @param \Symfony\Component\Routing\RouteCollection $collection
* The route collection.
*
* @see \Drupal\Core\Routing\RoutingEvents::ALTER
*/
public function buildRoutes(RouteCollection $collection);
/**
* Gets the URL used when redirecting away from the Layout Builder UI.
*
* @return \Drupal\Core\Url
* The URL object.
*/
public function getRedirectUrl();
/**
* Gets the URL used to display the Layout Builder UI.
*
* @param string $rel
* (optional) The link relationship type, for example: 'view' or 'disable'.
* Defaults to 'view'.
*
* @return \Drupal\Core\Url
* The URL object.
*/
public function getLayoutBuilderUrl($rel = 'view');
/**
* Configures the plugin based on route values.
*
* @param mixed $value
* The raw value.
* @param mixed $definition
* The parameter definition provided in the route options.
* @param string $name
* The name of the parameter.
* @param array $defaults
* The route defaults array.
*
* @return string|null
* The section storage ID if it could be extracted, NULL otherwise.
*
* @internal
* This should only be called during section storage instantiation.
*
* @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0.
* \Drupal\layout_builder\SectionStorageInterface::deriveContextsFromRoute()
* should be used instead. See https://www.drupal.org/node/3016262.
*/
public function extractIdFromRoute($value, $definition, $name, array $defaults);
/**
* Derives the available plugin contexts from route values.
*
* This should only be called during section storage instantiation,
* specifically for use by the routing system. For all non-routing usages, use
* \Drupal\Component\Plugin\ContextAwarePluginInterface::getContextValue().
*
* @param mixed $value
* The raw value.
* @param mixed $definition
* The parameter definition provided in the route options.
* @param string $name
* The name of the parameter.
* @param array $defaults
* The route defaults array.
*
* @return \Drupal\Core\Plugin\Context\ContextInterface[]
* The available plugin contexts.
*
* @see \Drupal\Core\ParamConverter\ParamConverterInterface::convert()
*/
public function deriveContextsFromRoute($value, $definition, $name, array $defaults);
/**
* Gets contexts for use during preview.
*
* When not in preview, ::getContexts() will be used.
*
* @return \Drupal\Core\Plugin\Context\ContextInterface[]
* The plugin contexts suitable for previewing.
*/
public function getContextsDuringPreview();
/**
* Gets the label for the object using the sections.
*
* @return string
* The label, or NULL if there is no label defined.
*/
public function label();
/**
* Saves the sections.
*
* @return int
* SAVED_NEW or SAVED_UPDATED is returned depending on the operation
* performed.
*/
public function save();
/**
* @return \Drupal\layout_builder\CachableApplicabilityResult;
*/
public function getRouterApplicability();
/**
* @return \Drupal\layout_builder\CachableApplicabilityResult;
*/
public function getRenderApplicability();
}