public function WebformAccessBreadcrumbBuilder::applies in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_access/src/Breadcrumb/WebformAccessBreadcrumbBuilder.php \Drupal\webform_access\Breadcrumb\WebformAccessBreadcrumbBuilder::applies()
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 BreadcrumbBuilderInterface::applies
File
- modules/
webform_access/ src/ Breadcrumb/ WebformAccessBreadcrumbBuilder.php, line 40
Class
- WebformAccessBreadcrumbBuilder
- Provides a webform access breadcrumb builder.
Namespace
Drupal\webform_access\BreadcrumbCode
public function applies(RouteMatchInterface $route_match) {
$route_name = $route_match
->getRouteName();
// All routes must begin or contain 'webform_access'.
if (strpos($route_name, 'webform_access') === FALSE) {
return FALSE;
}
if (!$route_match
->getRouteObject()) {
return FALSE;
}
$path = Url::fromRouteMatch($route_match)
->toString();
if (strpos($path, 'admin/structure/webform/access/') === FALSE) {
return FALSE;
}
if (strpos($path, 'admin/structure/webform/access/group/manage/') !== FALSE) {
$this->type = 'webform_access_group';
}
elseif (strpos($path, 'admin/structure/webform/access/type/manage/') !== FALSE) {
$this->type = 'webform_access_type';
}
else {
$this->type = 'webform_access';
}
return $this->type ? TRUE : FALSE;
}