Mercurial > hg > isophonics-drupal-site
comparison core/modules/layout_builder/src/SectionStorageInterface.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\layout_builder; | |
4 | |
5 use Drupal\Component\Plugin\PluginInspectionInterface; | |
6 use Symfony\Component\Routing\RouteCollection; | |
7 | |
8 /** | |
9 * Defines an interface for Section Storage type plugins. | |
10 * | |
11 * @internal | |
12 * Layout Builder is currently experimental and should only be leveraged by | |
13 * experimental modules and development releases of contributed modules. | |
14 * See https://www.drupal.org/core/experimental for more information. | |
15 */ | |
16 interface SectionStorageInterface extends SectionListInterface, PluginInspectionInterface { | |
17 | |
18 /** | |
19 * Returns an identifier for this storage. | |
20 * | |
21 * @return string | |
22 * The unique identifier for this storage. | |
23 */ | |
24 public function getStorageId(); | |
25 | |
26 /** | |
27 * Returns the type of this storage. | |
28 * | |
29 * Used in conjunction with the storage ID. | |
30 * | |
31 * @return string | |
32 * The type of storage. | |
33 */ | |
34 public function getStorageType(); | |
35 | |
36 /** | |
37 * Sets the section list on the storage. | |
38 * | |
39 * @param \Drupal\layout_builder\SectionListInterface $section_list | |
40 * The section list. | |
41 * | |
42 * @return $this | |
43 * | |
44 * @internal | |
45 * This should only be called during section storage instantiation. | |
46 */ | |
47 public function setSectionList(SectionListInterface $section_list); | |
48 | |
49 /** | |
50 * Derives the section list from the storage ID. | |
51 * | |
52 * @param string $id | |
53 * The storage ID, see ::getStorageId(). | |
54 * | |
55 * @return \Drupal\layout_builder\SectionListInterface | |
56 * The section list. | |
57 * | |
58 * @throws \InvalidArgumentException | |
59 * Thrown if the ID is invalid. | |
60 * | |
61 * @internal | |
62 * This should only be called during section storage instantiation. | |
63 */ | |
64 public function getSectionListFromId($id); | |
65 | |
66 /** | |
67 * Provides the routes needed for Layout Builder UI. | |
68 * | |
69 * Allows the plugin to add or alter routes during the route building process. | |
70 * \Drupal\layout_builder\Routing\LayoutBuilderRoutesTrait is provided for the | |
71 * typical use case of building a standard Layout Builder UI. | |
72 * | |
73 * @param \Symfony\Component\Routing\RouteCollection $collection | |
74 * The route collection. | |
75 * | |
76 * @see \Drupal\Core\Routing\RoutingEvents::ALTER | |
77 */ | |
78 public function buildRoutes(RouteCollection $collection); | |
79 | |
80 /** | |
81 * Gets the URL used when redirecting away from the Layout Builder UI. | |
82 * | |
83 * @return \Drupal\Core\Url | |
84 * The URL object. | |
85 */ | |
86 public function getRedirectUrl(); | |
87 | |
88 /** | |
89 * Gets the URL used to display the Layout Builder UI. | |
90 * | |
91 * @return \Drupal\Core\Url | |
92 * The URL object. | |
93 */ | |
94 public function getLayoutBuilderUrl(); | |
95 | |
96 /** | |
97 * Configures the plugin based on route values. | |
98 * | |
99 * @param mixed $value | |
100 * The raw value. | |
101 * @param mixed $definition | |
102 * The parameter definition provided in the route options. | |
103 * @param string $name | |
104 * The name of the parameter. | |
105 * @param array $defaults | |
106 * The route defaults array. | |
107 * | |
108 * @return string|null | |
109 * The section storage ID if it could be extracted, NULL otherwise. | |
110 * | |
111 * @internal | |
112 * This should only be called during section storage instantiation. | |
113 */ | |
114 public function extractIdFromRoute($value, $definition, $name, array $defaults); | |
115 | |
116 /** | |
117 * Provides any available contexts for the object using the sections. | |
118 * | |
119 * @return \Drupal\Core\Plugin\Context\ContextInterface[] | |
120 * The array of context objects. | |
121 */ | |
122 public function getContexts(); | |
123 | |
124 /** | |
125 * Gets the label for the object using the sections. | |
126 * | |
127 * @return string | |
128 * The label, or NULL if there is no label defined. | |
129 */ | |
130 public function label(); | |
131 | |
132 /** | |
133 * Saves the sections. | |
134 * | |
135 * @return int | |
136 * SAVED_NEW or SAVED_UPDATED is returned depending on the operation | |
137 * performed. | |
138 */ | |
139 public function save(); | |
140 | |
141 } |