class ThunderNodeEditBreadcrumbBuilder in Thunder 6.2.x
Same name and namespace in other branches
- 6.1.x src/Breadcrumb/ThunderNodeEditBreadcrumbBuilder.php \Drupal\thunder\Breadcrumb\ThunderNodeEditBreadcrumbBuilder
Class to define the breadcrumb builder.
Hierarchy
- class \Drupal\thunder\Breadcrumb\ThunderNodeEditBreadcrumbBuilder implements BreadcrumbBuilderInterface uses StringTranslationTrait
Expanded class hierarchy of ThunderNodeEditBreadcrumbBuilder
1 string reference to 'ThunderNodeEditBreadcrumbBuilder'
1 service uses ThunderNodeEditBreadcrumbBuilder
File
- src/
Breadcrumb/ ThunderNodeEditBreadcrumbBuilder.php, line 14
Namespace
Drupal\thunder\BreadcrumbView source
class ThunderNodeEditBreadcrumbBuilder implements BreadcrumbBuilderInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $route_match) {
return in_array($route_match
->getRouteName(), [
'entity.node.edit_form',
'node.add',
'node.add_page',
]);
}
/**
* {@inheritdoc}
*/
public function build(RouteMatchInterface $route_match) {
$breadcrumb = new Breadcrumb();
$breadcrumb
->addCacheContexts([
'route',
]);
$links[] = Link::createFromRoute($this
->t('Home'), '<front>');
$links[] = Link::createFromRoute($this
->t('Overview'), 'system.admin_content');
if ($route_match
->getRouteName() == 'node.add') {
$links[] = Link::createFromRoute($this
->t('Add content'), 'node.add_page');
}
return $breadcrumb
->setLinks($links);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
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. | |
ThunderNodeEditBreadcrumbBuilder:: |
public | function |
Whether this breadcrumb builder should be used to build the breadcrumb. Overrides BreadcrumbBuilderInterface:: |
|
ThunderNodeEditBreadcrumbBuilder:: |
public | function |
Builds the breadcrumb. Overrides BreadcrumbBuilderInterface:: |