class BusinessRulesBreadcrumb in Business Rules 8
Same name and namespace in other branches
- 2.x src/BusinessRulesBreadcrumb.php \Drupal\business_rules\BusinessRulesBreadcrumb
Adjust the breadcrumbs for the Business Rules module.
@package Drupal\business_rules
Hierarchy
- class \Drupal\system\PathBasedBreadcrumbBuilder implements BreadcrumbBuilderInterface uses StringTranslationTrait
- class \Drupal\business_rules\BusinessRulesBreadcrumb
Expanded class hierarchy of BusinessRulesBreadcrumb
1 string reference to 'BusinessRulesBreadcrumb'
1 service uses BusinessRulesBreadcrumb
File
- src/
BusinessRulesBreadcrumb.php, line 14
Namespace
Drupal\business_rulesView source
class BusinessRulesBreadcrumb extends PathBasedBreadcrumbBuilder {
/**
* {@inheritdoc}
*/
public function applies(RouteMatchInterface $route_match) {
$route_name = $route_match
->getRouteName();
if (stristr($route_name, 'entity.business_rule')) {
return TRUE;
}
}
/**
* {@inheritdoc}
*/
public function build(RouteMatchInterface $route_match) {
/** @var \Drupal\Core\Breadcrumb\Breadcrumb $breadcrumb */
$breadcrumb = parent::build($route_match);
$route_name = $route_match
->getRouteName();
$breadcrumb
->addLink(Link::createFromRoute($this
->t('Business Rules'), 'entity.business_rule.collection'));
if (stristr($route_name, 'entity.business_rules_action')) {
$breadcrumb
->addLink(Link::createFromRoute($this
->t('Actions'), 'entity.business_rules_action.collection'));
}
elseif (stristr($route_name, 'entity.business_rules_condition')) {
$breadcrumb
->addLink(Link::createFromRoute($this
->t('Conditions'), 'entity.business_rules_condition.collection'));
}
elseif (stristr($route_name, 'entity.business_rules_variable')) {
$breadcrumb
->addLink(Link::createFromRoute($this
->t('Variables'), 'entity.business_rules_variable.collection'));
}
return $breadcrumb;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BusinessRulesBreadcrumb:: |
public | function |
Whether this breadcrumb builder should be used to build the breadcrumb. Overrides PathBasedBreadcrumbBuilder:: |
|
BusinessRulesBreadcrumb:: |
public | function |
Builds the breadcrumb. Overrides PathBasedBreadcrumbBuilder:: |
|
PathBasedBreadcrumbBuilder:: |
protected | property | The menu link access service. | |
PathBasedBreadcrumbBuilder:: |
protected | property | Site config object. | |
PathBasedBreadcrumbBuilder:: |
protected | property | The router request context. | |
PathBasedBreadcrumbBuilder:: |
protected | property | The current path service. | |
PathBasedBreadcrumbBuilder:: |
protected | property | The current user object. | |
PathBasedBreadcrumbBuilder:: |
protected | property | The patch matcher service. | |
PathBasedBreadcrumbBuilder:: |
protected | property | The inbound path processor. | |
PathBasedBreadcrumbBuilder:: |
protected | property | The dynamic router service. | |
PathBasedBreadcrumbBuilder:: |
protected | property | The title resolver. | |
PathBasedBreadcrumbBuilder:: |
protected | function | Matches a path in the router. | |
PathBasedBreadcrumbBuilder:: |
public | function | Constructs the PathBasedBreadcrumbBuilder. | |
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. |