Mercurial > hg > isophonics-drupal-site
comparison core/lib/Drupal/Core/Menu/MenuLinkInterface.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Core\Menu; | |
4 | |
5 use Drupal\Component\Plugin\PluginInspectionInterface; | |
6 use Drupal\Component\Plugin\DerivativeInspectionInterface; | |
7 use Drupal\Core\Cache\CacheableDependencyInterface; | |
8 | |
9 /** | |
10 * Defines an interface for classes providing a type of menu link. | |
11 */ | |
12 interface MenuLinkInterface extends PluginInspectionInterface, DerivativeInspectionInterface, CacheableDependencyInterface { | |
13 | |
14 /** | |
15 * Returns the weight of the menu link. | |
16 * | |
17 * @return int | |
18 * The weight of the menu link, 0 by default. | |
19 */ | |
20 public function getWeight(); | |
21 | |
22 /** | |
23 * Returns the localized title to be shown for this link. | |
24 * | |
25 * @return string | |
26 * The title of the menu link. | |
27 */ | |
28 public function getTitle(); | |
29 | |
30 /** | |
31 * Returns the description of the menu link. | |
32 * | |
33 * @return string | |
34 * The description of the menu link. | |
35 */ | |
36 public function getDescription(); | |
37 | |
38 /** | |
39 * Returns the menu name of the menu link. | |
40 * | |
41 * @return string | |
42 * The menu name of the menu link. | |
43 */ | |
44 public function getMenuName(); | |
45 | |
46 /** | |
47 * Returns the provider (module name) of the menu link. | |
48 * | |
49 * @return string | |
50 * The provider of the menu link. | |
51 */ | |
52 public function getProvider(); | |
53 | |
54 /** | |
55 * Returns the plugin ID of the menu link's parent, or an empty string. | |
56 * | |
57 * @return string | |
58 * The parent plugin ID. | |
59 */ | |
60 public function getParent(); | |
61 | |
62 /** | |
63 * Returns whether the menu link is enabled (not hidden). | |
64 * | |
65 * @return bool | |
66 * TRUE for enabled, FALSE otherwise. | |
67 */ | |
68 public function isEnabled(); | |
69 | |
70 /** | |
71 * Returns whether the child menu links should always been shown. | |
72 * | |
73 * @return bool | |
74 * TRUE for expanded, FALSE otherwise. | |
75 */ | |
76 public function isExpanded(); | |
77 | |
78 /** | |
79 * Returns whether this link can be reset. | |
80 * | |
81 * In general, only links that store overrides using the | |
82 * menu_link.static.overrides service should return TRUE for this method. | |
83 * | |
84 * @return bool | |
85 * TRUE if it can be reset, FALSE otherwise. | |
86 */ | |
87 public function isResettable(); | |
88 | |
89 /** | |
90 * Returns whether this link can be translated. | |
91 * | |
92 * @return bool | |
93 * TRUE if the link can be translated, FALSE otherwise. | |
94 */ | |
95 public function isTranslatable(); | |
96 | |
97 /** | |
98 * Returns whether this link can be deleted. | |
99 * | |
100 * @return bool | |
101 * TRUE if the link can be deleted, FALSE otherwise. | |
102 */ | |
103 public function isDeletable(); | |
104 | |
105 /** | |
106 * Returns the route name, if available. | |
107 * | |
108 * @return string | |
109 * The name of the route this menu link links to. | |
110 */ | |
111 public function getRouteName(); | |
112 | |
113 /** | |
114 * Returns the route parameters, if available. | |
115 * | |
116 * @return array | |
117 * An array of parameter names and values. | |
118 */ | |
119 public function getRouteParameters(); | |
120 | |
121 /** | |
122 * Returns a URL object containing either the external path or route. | |
123 * | |
124 * @param bool $title_attribute | |
125 * (optional) If TRUE, add the link description as the title attribute if | |
126 * the description is not empty. | |
127 * | |
128 * @return \Drupal\Core\Url | |
129 * A URL object containing either the external path or route. | |
130 */ | |
131 public function getUrlObject($title_attribute = TRUE); | |
132 | |
133 /** | |
134 * Returns the options for this link. | |
135 * | |
136 * @return array | |
137 * An associative array of options. | |
138 */ | |
139 public function getOptions(); | |
140 | |
141 /** | |
142 * Returns any metadata for this link. | |
143 * | |
144 * @return array | |
145 * The metadata for the menu link. | |
146 */ | |
147 public function getMetaData(); | |
148 | |
149 /** | |
150 * Updates the definition values for a menu link. | |
151 * | |
152 * Depending on the implementation details of the class, not all definition | |
153 * values may be changed. For example, changes to the title of a static link | |
154 * will be discarded. | |
155 * | |
156 * In general, this method should not be called directly, but will be called | |
157 * automatically from MenuLinkManagerInterface::updateDefinition(). | |
158 * | |
159 * @param array $new_definition_values | |
160 * The new values for the link definition. This will usually be just a | |
161 * subset of the plugin definition. | |
162 * @param bool $persist | |
163 * TRUE to have the link persist the changed values to any additional | |
164 * storage. | |
165 * | |
166 * @return array | |
167 * The plugin definition incorporating any allowed changes. | |
168 */ | |
169 public function updateLink(array $new_definition_values, $persist); | |
170 | |
171 /** | |
172 * Deletes a menu link. | |
173 * | |
174 * In general, this method should not be called directly, but will be called | |
175 * automatically from MenuLinkManagerInterface::removeDefinition(). | |
176 * | |
177 * This method will only delete the link from any additional storage, but not | |
178 * from the plugin.manager.menu.link service. | |
179 * | |
180 * @throws \Drupal\Component\Plugin\Exception\PluginException | |
181 * If the link is not deletable. | |
182 */ | |
183 public function deleteLink(); | |
184 | |
185 /** | |
186 * Returns the name of a class that can build an editing form for this link. | |
187 * | |
188 * To instantiate the form class, use an instance of the | |
189 * \Drupal\Core\DependencyInjection\ClassResolverInterface, such as from the | |
190 * class_resolver service. Then call the setMenuLinkInstance() method on the | |
191 * form instance with the menu link plugin instance. | |
192 * | |
193 * @todo Add a code example. https://www.drupal.org/node/2302849 | |
194 * | |
195 * @return string | |
196 * A class that implements \Drupal\Core\Menu\Form\MenuLinkFormInterface. | |
197 */ | |
198 public function getFormClass(); | |
199 | |
200 /** | |
201 * Returns route information for a route to delete the menu link. | |
202 * | |
203 * @return \Drupal\Core\Url|null | |
204 * A Url object, or NULL if there is no route (e.g. when the link is not | |
205 * deletable). | |
206 */ | |
207 public function getDeleteRoute(); | |
208 | |
209 /** | |
210 * Returns route information for a custom edit form for the menu link. | |
211 * | |
212 * Plugins should return a value here if they have a special edit form, or if | |
213 * they need to define additional local tasks, local actions, etc. that are | |
214 * visible from the edit form. | |
215 * | |
216 * @return \Drupal\Core\Url|null | |
217 * A Url object, or NULL if there is no route because there is no custom | |
218 * edit route for this instance. | |
219 */ | |
220 public function getEditRoute(); | |
221 | |
222 /** | |
223 * Returns route information for a route to translate the menu link. | |
224 * | |
225 * @return \Drupal\Core\Url|null | |
226 * A Url object, or NULL if there is no route (e.g. when the link is not | |
227 * translatable). | |
228 */ | |
229 public function getTranslateRoute(); | |
230 | |
231 } |