commit 5804c228701d24945bf1683ca0fd1b93f4485add Author: Lee Rowlands Date: Mon Aug 26 18:42:12 2013 +1000 Patch 46 diff --git a/core/includes/menu.inc b/core/includes/menu.inc index b466fec..b371b7f 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -2867,6 +2867,8 @@ function _menu_navigation_links_rebuild($menu) { array_multisort($sort, SORT_NUMERIC, $router_items); foreach ($router_items as $key => $router_item) { + // Add the path to the item. + $router_item['path'] = $key; // For performance reasons, do a straight query now and convert to a menu // link entity later. // @todo revisit before release. @@ -2874,9 +2876,8 @@ function _menu_navigation_links_rebuild($menu) { ->fields('menu_links') ->condition('link_path', $router_item['path']) ->condition('module', 'system') - ->execute()->fetchAll(); + ->execute()->fetch(); if ($existing_item) { - $existing_item = reset($existing_item); $existing_item->options = unserialize($existing_item->options); $router_item['mlid'] = $existing_item->mlid; 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 8311d21..7f7baaa 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 @@ -410,15 +410,16 @@ public function setParents(MenuLinkInterface $parent) { public function findParent(MenuLinkStorageControllerInterface $storage_controller, array $parent_candidates = array()) { $parent = FALSE; + $plid = $this->getParentLinkId(); // This item is explicitely top-level, skip the rest of the parenting. - if (!$this->getParentLinkId()) { + if (!$plid === 0) { return $parent; } // If we have a parent link ID, try to use that. $candidates = array(); - if ($this->getParentLinkId()) { - $candidates[] = $this->getParentLinkId(); + if ($plid) { + $candidates = array($plid); } // Else, if we have a link hierarchy try to find a valid parent in there. @@ -427,7 +428,6 @@ public function findParent(MenuLinkStorageControllerInterface $storage_controlle $candidates[] = $this->getMaterializedPathEntity($depth); } } - foreach ($candidates as $mlid) { if (isset($parent_candidates[$mlid])) { $parent = $parent_candidates[$mlid]; diff --git a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkAccessController.php b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkAccessController.php index a1c2c69..e710775 100644 --- a/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkAccessController.php +++ b/core/modules/menu_link/lib/Drupal/menu_link/MenuLinkAccessController.php @@ -27,11 +27,11 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A switch ($operation) { case 'reset': // Reset allowed for items defined via hook_menu() and customized. - return $entity->module == 'system' && $entity->customized; + return $entity->module->value == 'system' && $entity->customized->value; case 'delete': // Only items created by the menu module can be deleted. - return $entity->module == 'menu' || $entity->updated == 1; + return $entity->module->value == 'menu' || $entity->updated->value == 1; } }