Mercurial > hg > isophonics-drupal-site
comparison core/modules/layout_builder/src/SectionStorageInterface.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
2 | 2 |
3 namespace Drupal\layout_builder; | 3 namespace Drupal\layout_builder; |
4 | 4 |
5 use Drupal\Component\Plugin\PluginInspectionInterface; | 5 use Drupal\Component\Plugin\PluginInspectionInterface; |
6 use Drupal\Core\Access\AccessibleInterface; | 6 use Drupal\Core\Access\AccessibleInterface; |
7 use Drupal\Core\Cache\RefinableCacheableDependencyInterface; | |
8 use Drupal\Core\Plugin\ContextAwarePluginInterface; | |
9 use Drupal\Core\Session\AccountInterface; | |
7 use Symfony\Component\Routing\RouteCollection; | 10 use Symfony\Component\Routing\RouteCollection; |
8 | 11 |
9 /** | 12 /** |
10 * Defines an interface for Section Storage type plugins. | 13 * Defines an interface for Section Storage type plugins. |
11 * | |
12 * @internal | |
13 * Layout Builder is currently experimental and should only be leveraged by | |
14 * experimental modules and development releases of contributed modules. | |
15 * See https://www.drupal.org/core/experimental for more information. | |
16 */ | 14 */ |
17 interface SectionStorageInterface extends SectionListInterface, PluginInspectionInterface, AccessibleInterface { | 15 interface SectionStorageInterface extends SectionListInterface, PluginInspectionInterface, ContextAwarePluginInterface, AccessibleInterface { |
18 | 16 |
19 /** | 17 /** |
20 * Returns an identifier for this storage. | 18 * Returns an identifier for this storage. |
21 * | 19 * |
22 * @return string | 20 * @return string |
33 * The type of storage. | 31 * The type of storage. |
34 */ | 32 */ |
35 public function getStorageType(); | 33 public function getStorageType(); |
36 | 34 |
37 /** | 35 /** |
38 * Sets the section list on the storage. | |
39 * | |
40 * @param \Drupal\layout_builder\SectionListInterface $section_list | |
41 * The section list. | |
42 * | |
43 * @return $this | |
44 * | |
45 * @internal | |
46 * This should only be called during section storage instantiation. | |
47 */ | |
48 public function setSectionList(SectionListInterface $section_list); | |
49 | |
50 /** | |
51 * Derives the section list from the storage ID. | 36 * Derives the section list from the storage ID. |
52 * | 37 * |
53 * @param string $id | 38 * @param string $id |
54 * The storage ID, see ::getStorageId(). | 39 * The storage ID, see ::getStorageId(). |
55 * | 40 * |
59 * @throws \InvalidArgumentException | 44 * @throws \InvalidArgumentException |
60 * Thrown if the ID is invalid. | 45 * Thrown if the ID is invalid. |
61 * | 46 * |
62 * @internal | 47 * @internal |
63 * This should only be called during section storage instantiation. | 48 * This should only be called during section storage instantiation. |
49 * | |
50 * @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. The | |
51 * section list should be derived from context. See | |
52 * https://www.drupal.org/node/3016262. | |
64 */ | 53 */ |
65 public function getSectionListFromId($id); | 54 public function getSectionListFromId($id); |
66 | 55 |
67 /** | 56 /** |
68 * Provides the routes needed for Layout Builder UI. | 57 * Provides the routes needed for Layout Builder UI. |
113 * @return string|null | 102 * @return string|null |
114 * The section storage ID if it could be extracted, NULL otherwise. | 103 * The section storage ID if it could be extracted, NULL otherwise. |
115 * | 104 * |
116 * @internal | 105 * @internal |
117 * This should only be called during section storage instantiation. | 106 * This should only be called during section storage instantiation. |
107 * | |
108 * @deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. | |
109 * \Drupal\layout_builder\SectionStorageInterface::deriveContextsFromRoute() | |
110 * should be used instead. See https://www.drupal.org/node/3016262. | |
118 */ | 111 */ |
119 public function extractIdFromRoute($value, $definition, $name, array $defaults); | 112 public function extractIdFromRoute($value, $definition, $name, array $defaults); |
120 | 113 |
121 /** | 114 /** |
122 * Provides any available contexts for the object using the sections. | 115 * Derives the available plugin contexts from route values. |
116 * | |
117 * This should only be called during section storage instantiation, | |
118 * specifically for use by the routing system. For all non-routing usages, use | |
119 * \Drupal\Component\Plugin\ContextAwarePluginInterface::getContextValue(). | |
120 * | |
121 * @param mixed $value | |
122 * The raw value. | |
123 * @param mixed $definition | |
124 * The parameter definition provided in the route options. | |
125 * @param string $name | |
126 * The name of the parameter. | |
127 * @param array $defaults | |
128 * The route defaults array. | |
123 * | 129 * |
124 * @return \Drupal\Core\Plugin\Context\ContextInterface[] | 130 * @return \Drupal\Core\Plugin\Context\ContextInterface[] |
125 * The array of context objects. | 131 * The available plugin contexts. |
132 * | |
133 * @see \Drupal\Core\ParamConverter\ParamConverterInterface::convert() | |
126 */ | 134 */ |
127 public function getContexts(); | 135 public function deriveContextsFromRoute($value, $definition, $name, array $defaults); |
136 | |
137 /** | |
138 * Gets contexts for use during preview. | |
139 * | |
140 * When not in preview, ::getContexts() will be used. | |
141 * | |
142 * @return \Drupal\Core\Plugin\Context\ContextInterface[] | |
143 * The plugin contexts suitable for previewing. | |
144 */ | |
145 public function getContextsDuringPreview(); | |
128 | 146 |
129 /** | 147 /** |
130 * Gets the label for the object using the sections. | 148 * Gets the label for the object using the sections. |
131 * | 149 * |
132 * @return string | 150 * @return string |
141 * SAVED_NEW or SAVED_UPDATED is returned depending on the operation | 159 * SAVED_NEW or SAVED_UPDATED is returned depending on the operation |
142 * performed. | 160 * performed. |
143 */ | 161 */ |
144 public function save(); | 162 public function save(); |
145 | 163 |
164 /** | |
165 * Determines if this section storage is applicable for the current contexts. | |
166 * | |
167 * @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $cacheability | |
168 * Refinable cacheability object, typically provided by the section storage | |
169 * manager. When implementing this method, populate $cacheability with any | |
170 * information that affects whether this storage is applicable. | |
171 * | |
172 * @return bool | |
173 * TRUE if this section storage is applicable, FALSE otherwise. | |
174 * | |
175 * @internal | |
176 * This method is intended to be called by | |
177 * \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext(). | |
178 * | |
179 * @see \Drupal\Core\Cache\RefinableCacheableDependencyInterface | |
180 */ | |
181 public function isApplicable(RefinableCacheableDependencyInterface $cacheability); | |
182 | |
183 /** | |
184 * Overrides \Drupal\Component\Plugin\PluginInspectionInterface::getPluginDefinition(). | |
185 * | |
186 * @return \Drupal\layout_builder\SectionStorage\SectionStorageDefinition | |
187 * The section storage definition. | |
188 */ | |
189 public function getPluginDefinition(); | |
190 | |
191 /** | |
192 * Overrides \Drupal\Core\Access\AccessibleInterface::access(). | |
193 * | |
194 * @ingroup layout_builder_access | |
195 */ | |
196 public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE); | |
197 | |
146 } | 198 } |