Chris@0: storage = $entity_type_manager->getStorage('comment'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function applies(RouteMatchInterface $route_match) { Chris@0: return $route_match->getRouteName() == 'comment.reply' && $route_match->getParameter('entity'); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function build(RouteMatchInterface $route_match) { Chris@0: $breadcrumb = new Breadcrumb(); Chris@0: $breadcrumb->addCacheContexts(['route']); Chris@0: $breadcrumb->addLink(Link::createFromRoute($this->t('Home'), '')); Chris@0: Chris@0: $entity = $route_match->getParameter('entity'); Chris@18: $breadcrumb->addLink(new Link($entity->label(), $entity->toUrl())); Chris@0: $breadcrumb->addCacheableDependency($entity); Chris@0: Chris@0: if (($pid = $route_match->getParameter('pid')) && ($comment = $this->storage->load($pid))) { Chris@0: /** @var \Drupal\comment\CommentInterface $comment */ Chris@0: $breadcrumb->addCacheableDependency($comment); Chris@0: // Display link to parent comment. Chris@0: // @todo Clean-up permalink in https://www.drupal.org/node/2198041 Chris@18: $breadcrumb->addLink(new Link($comment->getSubject(), $comment->toUrl())); Chris@0: } Chris@0: Chris@0: return $breadcrumb; Chris@0: } Chris@0: Chris@0: }