diff --git a/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php b/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php index f045fef..98d2a8b 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/Entity/MenuLink.php @@ -129,13 +129,6 @@ class MenuLink extends Entity implements \ArrayAccess, MenuLinkInterface { public $external; /** - * Flag indicating whether any links have this link as a parent. - * - * @var int - */ - public $has_children = 0; - - /** * Flag for whether this link should be rendered as expanded in menus. * Expanded links always have their child links displayed, instead of only * when the link is in the active trail. @@ -152,14 +145,6 @@ class MenuLink extends Entity implements \ArrayAccess, MenuLinkInterface { public $weight = 0; /** - * The depth relative to the top level. A link with plid == 0 will have - * depth == 1. - * - * @var int - */ - public $depth; - - /** * A flag to indicate that the user has manually created or edited the link. * * @var int @@ -167,79 +152,6 @@ class MenuLink extends Entity implements \ArrayAccess, MenuLinkInterface { public $customized = 0; /** - * The first entity ID in the materialized path. - * - * @var int - * - * @todo Investigate whether the p1, p2, .. pX properties can be moved to a - * single array property. - */ - public $p1; - - /** - * The second entity ID in the materialized path. - * - * @var int - */ - public $p2; - - /** - * The third entity ID in the materialized path. - * - * @var int - */ - public $p3; - - /** - * The fourth entity ID in the materialized path. - * - * @var int - */ - public $p4; - - /** - * The fifth entity ID in the materialized path. - * - * @var int - */ - public $p5; - - /** - * The sixth entity ID in the materialized path. - * - * @var int - */ - public $p6; - - /** - * The seventh entity ID in the materialized path. - * - * @var int - */ - public $p7; - - /** - * The eighth entity ID in the materialized path. - * - * @var int - */ - public $p8; - - /** - * The ninth entity ID in the materialized path. - * - * @var int - */ - public $p9; - - /** - * The menu link modification timestamp. - * - * @var int - */ - public $updated = 0; - - /** * The name of the route associated with this menu link, if any. * * @var string @@ -513,11 +425,6 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) { $menu_tree_storage->postSaveMenuLink($this); - // First store the menu tree information itself. - $menu_tree_storage->saveNode($this); - - $menu_tree_storage->updateParentalStatus($this); - Cache::invalidateTags(array('menu' => $this->menu_name)); if (isset($this->original) && $this->menu_name != $this->original->menu_name) { Cache::invalidateTags(array('menu' => $this->original->menu_name)); @@ -548,13 +455,6 @@ public static function postLoad(EntityStorageInterface $storage, array &$entitie if ($menu_link->route_name) { $routes[$menu_link->id()] = $menu_link->route_name; } - - // Load the menu tree information. - if ($menu_tree_node = \Drupal::service('menu_link.tree_storage')->loadNode($menu_link->id())) { - foreach ($menu_tree_node as $key => $value) { - $menu_link->{$key} = $value; - } - } } // Now mass-load any routes needed and associate them. diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeStorage.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeStorage.php index 3441c04..96d8462 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeStorage.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeStorage.php @@ -249,7 +249,7 @@ public function getExpandedParents(array $parents, $menu_name) { return $result; } - public function findNodes($parameters, $menu_name = '') { + public function findVertices($parameters, $menu_name = '') { $query = $this->database->select('menu_tree'); $query->addField('menu_tree', 'mlid'); for ($i = 1; $i <= MENU_MAX_DEPTH; $i++) { @@ -280,14 +280,14 @@ public function findNodes($parameters, $menu_name = '') { return $query->execute()->fetchAllKeyed(0, 0); } - public function loadNode($mlid) { + public function loadVertex($mlid) { $query = $this->database->select('menu_tree'); $query->fields('menu_tree'); $query->condition('mlid', $mlid); return $query->execute()->fetchAssoc(); } - public function saveNode($menu_link) { + public function saveVertex($menu_link) { $values = array(); foreach (array('menu_name', 'mlid', 'plid', 'has_children', 'weight', 'expanded', 'depth', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9') as $key) { $values[$key] = $menu_link[$key]; @@ -299,13 +299,13 @@ public function saveNode($menu_link) { ->execute(); } - public function deleteNode($menu_link) { + public function deleteVertex($menu_link) { $this->database->delete('menu_tree') ->condition('mlid', $menu_link['mlid']) ->execute(); } - public function reparentNode($menu_link, $new_plid) { + public function reparentVertex($menu_link, $new_plid) { } } diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeStorageInterface.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeStorageInterface.php index 5ac542a..a02b89e 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeStorageInterface.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuTreeStorageInterface.php @@ -73,15 +73,15 @@ public function getPreventReparenting(); public function getExpandedParents(array $parents, $menu_name); - public function findNodes($parameters, $menu_name = ''); + public function findVertices($parameters, $menu_name = ''); - public function loadNode($mlid); + public function loadVertex($mlid); - public function saveNode($menu_link); + public function saveVertex($menu_link); - public function deleteNode($menu_link); + public function deleteVertex($menu_link); - public function reparentNode($menu_link, $new_plid); + public function reparentVertex($menu_link, $new_plid); } diff --git a/core/modules/menu_link/menu_link.install b/core/modules/menu_link/menu_link.install index 9588e50..a87c4b5 100644 --- a/core/modules/menu_link/menu_link.install +++ b/core/modules/menu_link/menu_link.install @@ -92,13 +92,6 @@ function menu_link_schema() { 'default' => 0, 'size' => 'small', ), - 'has_children' => array( - 'description' => 'Flag indicating whether any links have this link as a parent (1 = children exist, 0 = no children).', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - 'size' => 'small', - ), 'expanded' => array( 'description' => 'Flag for whether this link should be rendered as expanded in menus - expanded links always have their child links displayed, instead of only when the link is in the active trail (1 = expanded, 0 = not expanded)', 'type' => 'int', @@ -112,13 +105,6 @@ function menu_link_schema() { 'not null' => TRUE, 'default' => 0, ), - 'depth' => array( - 'description' => 'The depth relative to the top level. A link with plid == 0 will have depth == 1.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - 'size' => 'small', - ), 'customized' => array( 'description' => 'A flag to indicate that the user has manually created or edited the link (1 = customized, 0 = not customized).', 'type' => 'int', @@ -126,76 +112,6 @@ function menu_link_schema() { 'default' => 0, 'size' => 'small', ), - 'p1' => array( - 'description' => 'The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the plid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'p2' => array( - 'description' => 'The second mlid in the materialized path. See p1.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'p3' => array( - 'description' => 'The third mlid in the materialized path. See p1.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'p4' => array( - 'description' => 'The fourth mlid in the materialized path. See p1.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'p5' => array( - 'description' => 'The fifth mlid in the materialized path. See p1.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'p6' => array( - 'description' => 'The sixth mlid in the materialized path. See p1.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'p7' => array( - 'description' => 'The seventh mlid in the materialized path. See p1.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'p8' => array( - 'description' => 'The eighth mlid in the materialized path. See p1.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'p9' => array( - 'description' => 'The ninth mlid in the materialized path. See p1.', - 'type' => 'int', - 'unsigned' => TRUE, - 'not null' => TRUE, - 'default' => 0, - ), - 'updated' => array( - 'description' => 'Flag that indicates that this link was generated during the update from Drupal 5.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - 'size' => 'small', - ), 'route_name' => array( 'description' => 'The machine name of a defined Symfony Route this menu item represents.', 'type' => 'varchar', @@ -209,11 +125,6 @@ function menu_link_schema() { 'serialize' => TRUE, ), ), - 'indexes' => array( - 'path_menu' => array(array('link_path', 128), 'menu_name'), - 'menu_plid_expand_child' => array('menu_name', 'plid', 'expanded', 'has_children'), - 'menu_parents' => array('menu_name', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'), - ), 'primary key' => array('mlid'), ); @@ -233,6 +144,12 @@ function menu_link_schema() { 'unsigned' => TRUE, 'not null' => TRUE, ), + 'machine_name' => array( + 'description' => 'Unique machine name: Optional human-readable ID for this link.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => FALSE, + ), 'plid' => array( 'description' => 'The parent link ID (plid) is the mlid of the link above in the hierarchy, or zero if the link is at the top level in its menu.', 'type' => 'int',