I have created one custom page. Also created breadcrumb service which perfectly work for admin page but doesn't work for custom page.Even I have checked my custom theme setting where breadcrumb visibility is set true.
Snippet of code
company.services.yml
services:
company.breadcrumb:
class: Drupal\company\Breadcrumb\CompanyBreadcrumbBuilder
tags:
- { name: breadcrumb_builder, priority: 100 }
CompanyBreadcrumbBuilder.php
namespace Drupal\company\Breadcrumb;
use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Link;
class CompanyBreadcrumbBuilder implements BreadcrumbBuilderInterface{
/**
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $attributes) {
$parameters = $attributes->getParameters()->all();
return true;
}
/**
* {@inheritdoc}
*/
public function build(RouteMatchInterface $route_match) {
$breadcrumb = new Breadcrumb();
$breadcrumb->addLink(Link::createFromRoute('Home', '<front>'));
$breadcrumb->addLink(Link::createFromRoute('Article', '<front>'));
return $breadcrumb;
}
}
m missing something like setting?
Note: I m using bootstrap as base theme.