diff --git a/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php b/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php index 421870d..dbf7787 100644 --- a/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php +++ b/core/modules/path/lib/Drupal/path/Tests/PathTaxonomyTermTest.php @@ -17,7 +17,7 @@ class PathTaxonomyTermTest extends PathTestBase { * * @var array */ - public static $modules = array('taxonomy'); + public static $modules = array('taxonomy', 'views'); public static function getInfo() { return array( diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/MappingDefinitionTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/MappingDefinitionTest.php index ab7fb0d..480aaa2 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/MappingDefinitionTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/MappingDefinitionTest.php @@ -143,6 +143,7 @@ function testUserAttributesInMarkup() { * Creates a random term and ensures the right RDFa markup is used. */ function testTaxonomyTermRdfaAttributes() { + module_enable(array('views')); $vocabulary = $this->createVocabulary(); $term = $this->createTerm($vocabulary); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php index 31d01c5..55b3e0e 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php @@ -205,6 +205,7 @@ function testTaxonomyIndex() { * Tests that there is a link to the parent term on the child term page. */ function testTaxonomyTermHierarchyBreadcrumbs() { + module_enable(array('views')); // Create two taxonomy terms and set term2 as the parent of term1. $term1 = $this->createTerm($this->vocabulary); $term2 = $this->createTerm($this->vocabulary); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php index 3c47f15..ed9b1ab 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermTest.php @@ -284,6 +284,7 @@ function testTermAutocompletion() { * Save, edit and delete a term using the user interface. */ function testTermInterface() { + module_enable(array('views')); $edit = array( 'name' => $this->randomName(12), 'description[value]' => $this->randomName(100), diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 9ffe995..02d7a1d 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -9,6 +9,7 @@ use Drupal\taxonomy\Plugin\Core\Entity\Term; use Drupal\taxonomy\Plugin\Core\Entity\Vocabulary; use Drupal\Core\Entity\EntityInterface; +use Drupal\views\ViewExecutable; /** * Denotes that no term in the vocabulary has a parent. @@ -1527,3 +1528,27 @@ function taxonomy_library_info() { return $libraries; } + +/** + * Implements hook_views_pre_view(). + * + * @todo This hack used to live in taxonomy_term_page() with the following + * comment: This overrides any other possible breadcrumb and is a pure + * hard-coded presumption. Make this behavior configurable per vocabulary or + * term. + */ +function taxonomy_views_pre_view(ViewExecutable $view, &$display_id, array &$args) { + if ($view->storage->get('name') == 'taxonomy_term') { + $breadcrumb = array(); + $current = (object) array( + 'tid' => reset($args), + ); + while ($parents = taxonomy_term_load_parents($current->tid)) { + $current = array_shift($parents); + $breadcrumb[] = l($current->label(), 'taxonomy/term/' . $current->tid); + } + $breadcrumb[] = l(t('Home'), NULL); + $breadcrumb = array_reverse($breadcrumb); + drupal_set_breadcrumb($breadcrumb); + } +}