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 0184a7e..f045fef 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 @@ -436,7 +436,7 @@ public static function preDelete(EntityStorageInterface $storage, array $entitie foreach ($entities as $entity) { // Children get re-attached to the item's parent. if ($entity->has_children) { - $mlids = $menu_tree_storage->findNodes(array('plid' => $entity->plid)); + $mlids = $menu_tree_storage->findNodes(array('expanded' => array($entity->plid))); $children = $storage->loadMultiple($mlids); foreach ($children as $child) { // $menu_tree_storage->reparentNode($child, $entity->plid); @@ -494,6 +494,11 @@ public function preSave(EntityStorageInterface $storage) { elseif (empty($this->link_path)) { $this->link_path = \Drupal::urlGenerator()->getPathFromRoute($this->route_name, $this->route_parameters); } + + /** @var \Drupal\menu_link\MenuTreeStorageInterface $menu_tree_storage */ + $menu_tree_storage = \Drupal::service('menu_link.tree_storage'); + + $menu_tree_storage->postSaveMenuLink($this); } /**