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