diff -u b/core/includes/menu.inc b/core/includes/menu.inc --- b/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -13,6 +13,7 @@ use Drupal\Core\Routing\RequestHelper; use Drupal\Core\Template\Attribute; use Drupal\menu_link\Entity\MenuLink; +use Drupal\menu_link\MenuLinkInterface; use Drupal\menu_link\MenuLinkStorageController; use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Component\HttpFoundation\Request; @@ -633,7 +634,9 @@ * (link title attribute) matches the description, it is translated as well. */ function _menu_item_localize(&$item, $map, $link_translate = FALSE) { - $title_callback = $item['title_callback']; + // Allow default menu links to be translated. + // @todo Figure out a proper way to support translations of menu links. + $title_callback = $item instanceof MenuLinkInterface && !$item->customized ? 't' : $item['title_callback']; $item['localized_options'] = $item['options']; // All 'class' attributes are assumed to be an array during rendering, but // links stored in the database may use an old string value. reverted: --- b/core/modules/toolbar/toolbar.module +++ a/core/modules/toolbar/toolbar.module @@ -422,7 +422,6 @@ ->condition('module', 'system') ->condition('link_path', 'admin'); $result = $query->execute(); - debug($result); if (!empty($result)) { $admin_link = menu_link_load(reset($result)); $tree = menu_build_tree('admin', array( @@ -469,7 +468,6 @@ function toolbar_get_rendered_subtrees() { $subtrees = array(); $tree = toolbar_get_menu_tree(); - debug(array_keys($tree)); foreach ($tree as $tree_item) { $item = $tree_item['link']; if (!$item['hidden'] && $item['access']) { @@ -482,8 +480,6 @@ } $parents = $query->execute()->fetchCol(); $subtree = menu_build_tree($item['menu_name'], array('expanded' => $parents, 'min_depth' => $item['depth']+1)); - debug(array_keys($subtree)); - debug($item->id()); toolbar_menu_navigation_links($subtree); $subtree = menu_tree_output($subtree); $subtree = drupal_render($subtree); only in patch2: unchanged: --- a/core/modules/locale/lib/Drupal/locale/StringStorageException.php +++ b/core/modules/locale/lib/Drupal/locale/StringStorageException.php @@ -6,8 +6,14 @@ */ namespace Drupal\locale; +use Exception; /** * Defines an exception thrown when storage operations fail. */ -class StringStorageException extends \Exception { } +class StringStorageException extends \Exception { + public function __construct($message = "", $code = 0, Exception $previous = NULL) { + parent::__construct($message, $code, $previous); // TODO: Change the autogenerated stub + } + +} only in patch2: unchanged: --- a/core/modules/system/lib/Drupal/system/Tests/Menu/LinksTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/LinksTest.php @@ -7,6 +7,7 @@ namespace Drupal\system\Tests\Menu; +use Drupal\locale\TranslationString; use Drupal\simpletest\WebTestBase; /** @@ -260,4 +261,24 @@ public function testRouterIntegration() { $this->assertEqual($menu_link->route_parameters, array('value' => 'test')); } + /** + * Tests uninstall a module providing default links. + */ + public function testModuleUninstalledMenuLinks() { + \Drupal::moduleHandler()->install(array('menu_test')); + \Drupal::service('router.builder')->rebuild(); + menu_link_rebuild_defaults(); + $result = $menu_link = \Drupal::entityQuery('menu_link')->condition('machine_name', 'menu_test')->execute(); + $menu_links = \Drupal::entityManager()->getStorageController('menu_link')->loadMultiple($result); + $this->assertEqual(count($menu_links), 1); + $menu_link = reset($menu_links); + $this->assertEqual($menu_link->machine_name, 'menu_test'); + + // Uninstall the module and ensure the menu link got removed. + \Drupal::moduleHandler()->uninstall(array('menu_test')); + $result = $menu_link = \Drupal::entityQuery('menu_link')->condition('machine_name', 'menu_test')->execute(); + $menu_links = \Drupal::entityManager()->getStorageController('menu_link')->loadMultiple($result); + $this->assertEqual(count($menu_links), 0); + } + } only in patch2: unchanged: --- a/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php +++ b/core/modules/toolbar/lib/Drupal/toolbar/Tests/ToolbarAdminMenuTest.php @@ -411,6 +411,7 @@ function testLocaleTranslationSubtreesHashCacheClear() { 'translation' => 'untranslated', ); $this->drupalPostForm('admin/config/regional/translate', $search, t('Filter')); + $this->assertNoText(t('No strings available')); $this->assertText($name, 'Search found the string as untranslated.'); // Assume this is the only result.