コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function build(RouteMatchInterface $route_match)
 {
     $term = $route_match->getParameter('taxonomy_term');
     // @todo This overrides any other possible breadcrumb and is a pure
     //   hard-coded presumption. Make this behavior configurable per
     //   vocabulary or term.
     $breadcrumb = array();
     while ($parents = $this->termStorage->loadParents($term->id())) {
         $term = array_shift($parents);
         $term = $this->entityManager->getTranslationFromContext($term);
         $breadcrumb[] = Link::createFromRoute($term->getName(), 'entity.taxonomy_term.canonical', array('taxonomy_term' => $term->id()));
     }
     $breadcrumb[] = Link::createFromRoute($this->t('Home'), '<front>');
     $breadcrumb = array_reverse($breadcrumb);
     return $breadcrumb;
 }