class RegistrationBreadcrumbBuilder in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Breadcrumb/RegistrationBreadcrumbBuilder.php \Drupal\rng\Breadcrumb\RegistrationBreadcrumbBuilder
- 3.x src/Breadcrumb/RegistrationBreadcrumbBuilder.php \Drupal\rng\Breadcrumb\RegistrationBreadcrumbBuilder
Provides a breadcrumb builder for registrations.
Hierarchy
- class \Drupal\rng\Breadcrumb\RegistrationBreadcrumbBuilder implements BreadcrumbBuilderInterface uses StringTranslationTrait
Expanded class hierarchy of RegistrationBreadcrumbBuilder
1 string reference to 'RegistrationBreadcrumbBuilder'
1 service uses RegistrationBreadcrumbBuilder
File
- src/
Breadcrumb/ RegistrationBreadcrumbBuilder.php, line 15
Namespace
Drupal\rng\BreadcrumbView source
class RegistrationBreadcrumbBuilder implements BreadcrumbBuilderInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $route_match) {
$registration = $route_match
->getParameter('registration');
return $registration instanceof RegistrationInterface;
}
/**
* {@inheritdoc}
*/
public function build(RouteMatchInterface $route_match) {
$links = array(
Link::createFromRoute($this
->t('Home'), '<front>'),
);
$registration = $route_match
->getParameter('registration');
if ($event = $registration
->getEvent()) {
$links[] = new Link($event
->label(), $event
->urlInfo());
}
if ('entity.registration.canonical' != $route_match
->getRouteName()) {
$links[] = new Link($registration
->label(), $registration
->urlInfo());
}
$breadcrumb = new Breadcrumb();
return $breadcrumb
->setLinks($links)
->addCacheContexts([
'route.name',
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RegistrationBreadcrumbBuilder:: |
public | function |
Whether this breadcrumb builder should be used to build the breadcrumb. Overrides BreadcrumbBuilderInterface:: |
|
RegistrationBreadcrumbBuilder:: |
public | function |
Builds the breadcrumb. Overrides BreadcrumbBuilderInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |