class GroupBreadcrumbBuilder in RNG - Events and Registrations 8.2
Same name and namespace in other branches
- 8 src/Breadcrumb/GroupBreadcrumbBuilder.php \Drupal\rng\Breadcrumb\GroupBreadcrumbBuilder
- 3.x src/Breadcrumb/GroupBreadcrumbBuilder.php \Drupal\rng\Breadcrumb\GroupBreadcrumbBuilder
Provides a breadcrumb builder for groups.
Hierarchy
- class \Drupal\rng\Breadcrumb\GroupBreadcrumbBuilder implements BreadcrumbBuilderInterface uses StringTranslationTrait
Expanded class hierarchy of GroupBreadcrumbBuilder
1 string reference to 'GroupBreadcrumbBuilder'
1 service uses GroupBreadcrumbBuilder
File
- src/
Breadcrumb/ GroupBreadcrumbBuilder.php, line 15
Namespace
Drupal\rng\BreadcrumbView source
class GroupBreadcrumbBuilder implements BreadcrumbBuilderInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $route_match) {
$group = $route_match
->getParameter('registration_group');
return $group instanceof GroupInterface;
}
/**
* {@inheritdoc}
*/
public function build(RouteMatchInterface $route_match) {
$links = [
Link::createFromRoute($this
->t('Home'), '<front>'),
];
/** @var \Drupal\rng\Entity\GroupInterface $group */
$group = $route_match
->getParameter('registration_group');
if ($event = $group
->getEvent()) {
$links[] = new Link($event
->label(), $event
->urlInfo());
}
$breadcrumb = new Breadcrumb();
return $breadcrumb
->setLinks($links)
->addCacheContexts([
'route.name',
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GroupBreadcrumbBuilder:: |
public | function |
Whether this breadcrumb builder should be used to build the breadcrumb. Overrides BreadcrumbBuilderInterface:: |
|
GroupBreadcrumbBuilder:: |
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. |