annotate core/modules/menu_link_content/src/MenuLinkContentInterface.php @ 0:4c8ae668cc8c

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