public function CartBreadcrumbBuilder::build in Ubercart 8.4
Builds the breadcrumb.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.
Return value
\Drupal\Core\Breadcrumb\Breadcrumb A breadcrumb.
Overrides BreadcrumbBuilderInterface::build
File
- uc_cart/
src/ CartBreadcrumbBuilder.php, line 29
Class
- CartBreadcrumbBuilder
- Provides a custom breadcrumb builder for the cart page.
Namespace
Drupal\uc_cartCode
public function build(RouteMatchInterface $route_match) {
$config = \Drupal::config('uc_cart.settings');
$text = $config
->get('breadcrumb_text');
$links[] = Link::createFromRoute($this
->t('Home'), '<front>');
$links[] = Link::fromTextAndUrl($text, Url::fromUri('internal:/' . $config
->get('breadcrumb_url'), [
'absolute' => TRUE,
]));
$breadcrumb = new Breadcrumb();
$breadcrumb
->setLinks($links);
return $breadcrumb;
}