Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\menu_link_content;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\Entity\EntityChangedInterface;
|
Chris@0
|
6 use Drupal\Core\Entity\ContentEntityInterface;
|
Chris@17
|
7 use Drupal\Core\Entity\EntityPublishedInterface;
|
Chris@18
|
8 use Drupal\Core\Entity\RevisionLogInterface;
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Defines an interface for custom menu links.
|
Chris@0
|
12 */
|
Chris@18
|
13 interface MenuLinkContentInterface extends ContentEntityInterface, EntityChangedInterface, EntityPublishedInterface, RevisionLogInterface {
|
Chris@0
|
14
|
Chris@0
|
15 /**
|
Chris@0
|
16 * Flags this instance as being wrapped in a menu link plugin instance.
|
Chris@0
|
17 */
|
Chris@0
|
18 public function setInsidePlugin();
|
Chris@0
|
19
|
Chris@0
|
20 /**
|
Chris@0
|
21 * Gets the title of the menu link.
|
Chris@0
|
22 *
|
Chris@0
|
23 * @return string
|
Chris@0
|
24 * The title of the link.
|
Chris@0
|
25 */
|
Chris@0
|
26 public function getTitle();
|
Chris@0
|
27
|
Chris@0
|
28 /**
|
Chris@0
|
29 * Gets the url object pointing to the URL of the menu link content entity.
|
Chris@0
|
30 *
|
Chris@0
|
31 * @return \Drupal\Core\Url
|
Chris@0
|
32 * A Url object instance.
|
Chris@0
|
33 */
|
Chris@0
|
34 public function getUrlObject();
|
Chris@0
|
35
|
Chris@0
|
36 /**
|
Chris@0
|
37 * Gets the menu name of the custom menu link.
|
Chris@0
|
38 *
|
Chris@0
|
39 * @return string
|
Chris@0
|
40 * The menu ID.
|
Chris@0
|
41 */
|
Chris@0
|
42 public function getMenuName();
|
Chris@0
|
43
|
Chris@0
|
44 /**
|
Chris@0
|
45 * Gets the description of the menu link for the UI.
|
Chris@0
|
46 *
|
Chris@0
|
47 * @return string
|
Chris@0
|
48 * The description to use on admin pages or as a title attribute.
|
Chris@0
|
49 */
|
Chris@0
|
50 public function getDescription();
|
Chris@0
|
51
|
Chris@0
|
52 /**
|
Chris@0
|
53 * Gets the menu plugin ID associated with this entity.
|
Chris@0
|
54 *
|
Chris@0
|
55 * @return string
|
Chris@0
|
56 * The plugin ID.
|
Chris@0
|
57 */
|
Chris@0
|
58 public function getPluginId();
|
Chris@0
|
59
|
Chris@0
|
60 /**
|
Chris@0
|
61 * Returns whether the menu link is marked as enabled.
|
Chris@0
|
62 *
|
Chris@0
|
63 * @return bool
|
Chris@0
|
64 * TRUE if is enabled, otherwise FALSE.
|
Chris@0
|
65 */
|
Chris@0
|
66 public function isEnabled();
|
Chris@0
|
67
|
Chris@0
|
68 /**
|
Chris@0
|
69 * Returns whether the menu link is marked as always expanded.
|
Chris@0
|
70 *
|
Chris@0
|
71 * @return bool
|
Chris@0
|
72 * TRUE for expanded, FALSE otherwise.
|
Chris@0
|
73 */
|
Chris@0
|
74 public function isExpanded();
|
Chris@0
|
75
|
Chris@0
|
76 /**
|
Chris@0
|
77 * Gets the plugin ID of the parent menu link.
|
Chris@0
|
78 *
|
Chris@0
|
79 * @return string
|
Chris@0
|
80 * A plugin ID, or empty string if this link is at the top level.
|
Chris@0
|
81 */
|
Chris@0
|
82 public function getParentId();
|
Chris@0
|
83
|
Chris@0
|
84 /**
|
Chris@0
|
85 * Returns the weight of the menu link content entity.
|
Chris@0
|
86 *
|
Chris@0
|
87 * @return int
|
Chris@0
|
88 * A weight for use when ordering links.
|
Chris@0
|
89 */
|
Chris@0
|
90 public function getWeight();
|
Chris@0
|
91
|
Chris@0
|
92 /**
|
Chris@0
|
93 * Builds up the menu link plugin definition for this entity.
|
Chris@0
|
94 *
|
Chris@0
|
95 * @return array
|
Chris@0
|
96 * The plugin definition corresponding to this entity.
|
Chris@0
|
97 *
|
Chris@0
|
98 * @see \Drupal\Core\Menu\MenuLinkTree::$defaults
|
Chris@0
|
99 */
|
Chris@0
|
100 public function getPluginDefinition();
|
Chris@0
|
101
|
Chris@0
|
102 /**
|
Chris@0
|
103 * Returns whether the menu link requires rediscovery.
|
Chris@0
|
104 *
|
Chris@0
|
105 * If a menu-link points to a user-supplied path such as /blog then the route
|
Chris@0
|
106 * this resolves to needs to be rediscovered as the module or route providing
|
Chris@0
|
107 * a given path might change over time.
|
Chris@0
|
108 *
|
Chris@0
|
109 * For example: at the time a menu-link is created, the /blog path might be
|
Chris@0
|
110 * provided by a route in Views module, but later this path may be served by
|
Chris@0
|
111 * the Panels module. Flagging a link as requiring rediscovery ensures that if
|
Chris@0
|
112 * the route that provides a user-entered path changes over time, the link is
|
Chris@0
|
113 * flexible enough to update to reflect these changes.
|
Chris@0
|
114 *
|
Chris@0
|
115 * @return bool
|
Chris@0
|
116 * TRUE if the menu link requires rediscovery during route rebuilding.
|
Chris@0
|
117 */
|
Chris@0
|
118 public function requiresRediscovery();
|
Chris@0
|
119
|
Chris@0
|
120 /**
|
Chris@0
|
121 * Flags a link as requiring rediscovery.
|
Chris@0
|
122 *
|
Chris@0
|
123 * @param bool $rediscovery
|
Chris@0
|
124 * Whether or not the link requires rediscovery.
|
Chris@0
|
125 *
|
Chris@0
|
126 * @return $this
|
Chris@0
|
127 * The instance on which the method was called.
|
Chris@0
|
128 *
|
Chris@0
|
129 * @see \Drupal\menu_link_content\MenuLinkContentInterface::requiresRediscovery()
|
Chris@0
|
130 */
|
Chris@0
|
131 public function setRequiresRediscovery($rediscovery);
|
Chris@0
|
132
|
Chris@0
|
133 }
|