public function InvoiceBreadcrumbBuilder::applies in Commerce Invoice 8.2
Whether this breadcrumb builder should be used to build the breadcrumb.
Parameters
\Drupal\Core\Routing\RouteMatchInterface $route_match: The current route match.
Return value
bool TRUE if this builder should be used or FALSE to let other builders decide.
Overrides PathBasedBreadcrumbBuilder::applies
File
- src/
InvoiceBreadcrumbBuilder.php, line 20
Class
- InvoiceBreadcrumbBuilder
- Defines the Commerce Invoice breadcrumb builder.
Namespace
Drupal\commerce_invoiceCode
public function applies(RouteMatchInterface $route_match) {
// This breadcrumb builder applies only when an invoice corresponds to a
// single order.
$invoice = $route_match
->getParameter('commerce_invoice');
return $invoice instanceof InvoiceInterface && $invoice
->get('orders')
->count() === 1;
}