diff --git a/core/modules/menu_link/menu_link.module b/core/modules/menu_link/menu_link.module index 0eb234d..36a78bb 100644 --- a/core/modules/menu_link/menu_link.module +++ b/core/modules/menu_link/menu_link.module @@ -201,7 +201,6 @@ function menu_link_maintain($module, $op, $link_path, $link_title = NULL) { * Implements hook_system_breadcrumb_alter(). */ function menu_link_system_breadcrumb_alter(array &$breadcrumb, array $attributes, array $context) { - // Custom breadcrumb behaviour for editing menu links, we append a link to // the menu in which the link is found. if (!empty($attributes[RouteObjectInterface::ROUTE_NAME]) && $attributes[RouteObjectInterface::ROUTE_NAME] == 'menu_link_edit' && !empty($attributes['menu_link'])) { diff --git a/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php b/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php index 1ec5059..36eb0cc 100644 --- a/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php +++ b/core/modules/system/lib/Drupal/system/PathBasedBreadcrumbBuilder.php @@ -10,6 +10,7 @@ use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface; use Drupal\Core\Config\ConfigFactory; use Drupal\Core\Entity\EntityManager; +use Drupal\Core\Routing\RequestHelper; use Drupal\Core\StringTranslation\TranslationInterface; use Drupal\Core\Access\AccessManager; use Drupal\Core\PathProcessor\InboundPathProcessorInterface; @@ -158,6 +159,8 @@ public function build(array $attributes) { } if ($access) { if (!$title) { + // @todo Skip this part once we have a _title_callback, see + // https://drupal.org/node/2076085. $title = str_replace(array('-', '_'), ' ', Unicode::ucfirst(end($path_elements))); } // @todo Replace with a #type => link render element or use the link @@ -184,7 +187,7 @@ public function build(array $attributes) { * A populated request object or NULL if the patch couldn't be matched. */ protected function getRequestForPath($path) { - $request = Request::create($path); + $request = RequestHelper::duplicate($path, $this->request); $processed = $this->pathProcessor->processInbound($path, $request); $request->attributes->set('_system_path', $processed); // Attempt to match this path to provide a fully built request. diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php index 9255976..9e985a2 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php @@ -61,8 +61,6 @@ function testBreadCrumbs() { // Prepare common base breadcrumb elements. $home = array('' => 'Home'); $admin = $home + array('admin' => t('Administration')); - // @todo Revert to 'Configuration' when https://drupal.org/node/2075701 is - // in. $config = $admin + array('admin/config' => t('Configuration')); $type = 'article'; $langcode = Language::LANGCODE_NOT_SPECIFIED; @@ -143,6 +141,8 @@ function testBreadCrumbs() { ); $this->assertBreadcrumb('admin/config/content/formats/add', $trail); $this->assertBreadcrumb("admin/config/content/formats/manage/$format_id", $trail); + // @todo Remove this part once we have a _title_callback, see + // https://drupal.org/node/2076085. $trail += array( "admin/config/content/formats/manage/$format_id" => Unicode::ucfirst(Unicode::strtolower($format->name)), ); @@ -402,7 +402,7 @@ function testBreadCrumbs() { $this->drupalLogin($this->web_user); // Verify that we can access recent log entries, there is a corresponding - // page title, and that the breadcrumb is just the Home linke (because the + // page title, and that the breadcrumb is just the Home link (because the // user is not able to access "Administer". $trail = $home; $this->assertBreadcrumb('admin', $trail, t('Access denied')); diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index d7c14b3..e0f078e 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -1354,20 +1354,19 @@ function hook_module_implements_alter(&$implementations, $hook) { * Perform alterations to the breadcrumb built by the BreadcrumbManager. * * @param array $breadcrumb - * An array of breadcrumb link a tags, returned by the breadcrumb manager build - * method, for example + * An array of breadcrumb link a tags, returned by the breadcrumb manager + * build method, for example * @code * array('Home'); * @endcode - * * @param array $attributes * Attributes representing the current page, coming from * \Drupal::request()->attributes. * @param array $context * May include the following key: - * - builder: the instance of \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface - * that constructed this breadcrumb, or NULL if no builder acted based on - * the current attributes. + * - builder: the instance of + * \Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface that constructed this + * breadcrumb, or NULL if no builder acted based on the current attributes. */ function hook_system_breadcrumb_alter(array &$breadcrumb, array $attributes, array $context) { // Add an item to the end of the breadcrumb.