3 namespace Drupal\menu_link_content;
5 use Drupal\Core\Entity\EntityChangedInterface;
6 use Drupal\Core\Entity\ContentEntityInterface;
9 * Defines an interface for custom menu links.
11 interface MenuLinkContentInterface extends ContentEntityInterface, EntityChangedInterface {
14 * Flags this instance as being wrapped in a menu link plugin instance.
16 public function setInsidePlugin();
19 * Gets the title of the menu link.
22 * The title of the link.
24 public function getTitle();
27 * Gets the url object pointing to the URL of the menu link content entity.
29 * @return \Drupal\Core\Url
30 * A Url object instance.
32 public function getUrlObject();
35 * Gets the menu name of the custom menu link.
40 public function getMenuName();
43 * Gets the description of the menu link for the UI.
46 * The description to use on admin pages or as a title attribute.
48 public function getDescription();
51 * Gets the menu plugin ID associated with this entity.
56 public function getPluginId();
59 * Returns whether the menu link is marked as enabled.
62 * TRUE if is enabled, otherwise FALSE.
64 public function isEnabled();
67 * Returns whether the menu link is marked as always expanded.
70 * TRUE for expanded, FALSE otherwise.
72 public function isExpanded();
75 * Gets the plugin ID of the parent menu link.
78 * A plugin ID, or empty string if this link is at the top level.
80 public function getParentId();
83 * Returns the weight of the menu link content entity.
86 * A weight for use when ordering links.
88 public function getWeight();
91 * Builds up the menu link plugin definition for this entity.
94 * The plugin definition corresponding to this entity.
96 * @see \Drupal\Core\Menu\MenuLinkTree::$defaults
98 public function getPluginDefinition();
101 * Returns whether the menu link requires rediscovery.
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.
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.
114 * TRUE if the menu link requires rediscovery during route rebuilding.
116 public function requiresRediscovery();
119 * Flags a link as requiring rediscovery.
121 * @param bool $rediscovery
122 * Whether or not the link requires rediscovery.
125 * The instance on which the method was called.
127 * @see \Drupal\menu_link_content\MenuLinkContentInterface::requiresRediscovery()
129 public function setRequiresRediscovery($rediscovery);