Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / layout_builder / src / SectionStorageInterface.php
1 <?php
2
3 namespace Drupal\layout_builder;
4
5 use Drupal\Component\Plugin\PluginInspectionInterface;
6 use Drupal\Core\Access\AccessibleInterface;
7 use Symfony\Component\Routing\RouteCollection;
8
9 /**
10  * 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  */
17 interface SectionStorageInterface extends SectionListInterface, PluginInspectionInterface, AccessibleInterface {
18
19   /**
20    * Returns an identifier for this storage.
21    *
22    * @return string
23    *   The unique identifier for this storage.
24    */
25   public function getStorageId();
26
27   /**
28    * Returns the type of this storage.
29    *
30    * Used in conjunction with the storage ID.
31    *
32    * @return string
33    *   The type of storage.
34    */
35   public function getStorageType();
36
37   /**
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.
52    *
53    * @param string $id
54    *   The storage ID, see ::getStorageId().
55    *
56    * @return \Drupal\layout_builder\SectionListInterface
57    *   The section list.
58    *
59    * @throws \InvalidArgumentException
60    *   Thrown if the ID is invalid.
61    *
62    * @internal
63    *   This should only be called during section storage instantiation.
64    */
65   public function getSectionListFromId($id);
66
67   /**
68    * Provides the routes needed for Layout Builder UI.
69    *
70    * Allows the plugin to add or alter routes during the route building process.
71    * \Drupal\layout_builder\Routing\LayoutBuilderRoutesTrait is provided for the
72    * typical use case of building a standard Layout Builder UI.
73    *
74    * @param \Symfony\Component\Routing\RouteCollection $collection
75    *   The route collection.
76    *
77    * @see \Drupal\Core\Routing\RoutingEvents::ALTER
78    */
79   public function buildRoutes(RouteCollection $collection);
80
81   /**
82    * Gets the URL used when redirecting away from the Layout Builder UI.
83    *
84    * @return \Drupal\Core\Url
85    *   The URL object.
86    */
87   public function getRedirectUrl();
88
89   /**
90    * Gets the URL used to display the Layout Builder UI.
91    *
92    * @param string $rel
93    *   (optional) The link relationship type, for example: 'view' or 'disable'.
94    *   Defaults to 'view'.
95    *
96    * @return \Drupal\Core\Url
97    *   The URL object.
98    */
99   public function getLayoutBuilderUrl($rel = 'view');
100
101   /**
102    * Configures the plugin based on route values.
103    *
104    * @param mixed $value
105    *   The raw value.
106    * @param mixed $definition
107    *   The parameter definition provided in the route options.
108    * @param string $name
109    *   The name of the parameter.
110    * @param array $defaults
111    *   The route defaults array.
112    *
113    * @return string|null
114    *   The section storage ID if it could be extracted, NULL otherwise.
115    *
116    * @internal
117    *   This should only be called during section storage instantiation.
118    */
119   public function extractIdFromRoute($value, $definition, $name, array $defaults);
120
121   /**
122    * Provides any available contexts for the object using the sections.
123    *
124    * @return \Drupal\Core\Plugin\Context\ContextInterface[]
125    *   The array of context objects.
126    */
127   public function getContexts();
128
129   /**
130    * Gets the label for the object using the sections.
131    *
132    * @return string
133    *   The label, or NULL if there is no label defined.
134    */
135   public function label();
136
137   /**
138    * Saves the sections.
139    *
140    * @return int
141    *   SAVED_NEW or SAVED_UPDATED is returned depending on the operation
142    *   performed.
143    */
144   public function save();
145
146 }