diff --git a/core/lib/Drupal/Core/Controller/ControllerBase.php b/core/lib/Drupal/Core/Controller/ControllerBase.php index b89a09a..7f058f8 100644 --- a/core/lib/Drupal/Core/Controller/ControllerBase.php +++ b/core/lib/Drupal/Core/Controller/ControllerBase.php @@ -215,19 +215,6 @@ public function l($text, $route_name, array $parameters = array(), array $option } /** - * Returns the current user. - * - * @return \Drupal\Core\Session\AccountInterface - * The current user. - */ - protected function currentUser() { - if (!$this->currentUser) { - $this->currentUser = $this->container()->get('current_user'); - } - return $this->currentUser; - } - - /** * Translates a string to the current language or to a given language. * * See the t() documentation for details. diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermBreadcrumbBuilder.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermBreadcrumbBuilder.php new file mode 100644 index 0000000..9aacdcb --- /dev/null +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermBreadcrumbBuilder.php @@ -0,0 +1,37 @@ +id())) { + $term = array_shift($parents); + $breadcrumb[] = $this->l($term->label(), 'taxonomy.term_page', array('taxonomy_term' => $term->id())); + } + $breadcrumb[] = $this->l($this->t('Home'), ''); + $breadcrumb = array_reverse($breadcrumb); + + return $breadcrumb; + } + } + +} diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc index 956bc71..ed40174 100644 --- a/core/modules/taxonomy/taxonomy.pages.inc +++ b/core/modules/taxonomy/taxonomy.pages.inc @@ -19,17 +19,6 @@ function taxonomy_term_page(Term $term) { // Assign the term name as the page title. drupal_set_title($term->label()); - // @todo This overrides any other possible breadcrumb and is a pure hard-coded - // presumption. Make this behavior configurable per vocabulary or term. - $breadcrumb = array(); - $current = $term; - while ($parents = taxonomy_term_load_parents($current->id())) { - $current = array_shift($parents); - $breadcrumb[] = l($current->label(), 'taxonomy/term/' . $current->id()); - } - $breadcrumb[] = l(t('Home'), NULL); - $breadcrumb = array_reverse($breadcrumb); - drupal_set_breadcrumb($breadcrumb); drupal_add_feed('taxonomy/term/' . $term->id() . '/feed', 'RSS - ' . $term->label()); foreach ($term->uriRelationships() as $rel) { diff --git a/core/modules/taxonomy/taxonomy.services.yml b/core/modules/taxonomy/taxonomy.services.yml new file mode 100644 index 0000000..686f6ea --- /dev/null +++ b/core/modules/taxonomy/taxonomy.services.yml @@ -0,0 +1,5 @@ +services: + taxonomy_term.breadcrumb: + class: Drupal\taxonomy\TermBreadcrumbBuilder + tags: + - { name: breadcrumb_builder, priority: 1002 }