Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
facets_pretty_paths
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
facets_pretty_paths
Merge requests
!21
Issue
#3336041
: Add check if current page is a node page
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3336041
: Add check if current page is a node page
issue/facets_pretty_paths-3336041:3336041-breadcrumbs-issue-2x
into
2.0.x
Overview
0
Commits
1
Pipelines
1
Changes
1
Open
Oleksandr Kuzava
requested to merge
issue/facets_pretty_paths-3336041:3336041-breadcrumbs-issue-2x
into
2.0.x
3 months ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
Closes
#3336041
0
0
Merge request reports
Compare
2.0.x
2.0.x (HEAD)
and
latest version
latest version
6c4f756f
1 commit,
3 months ago
1 file
+
9
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/PrettyPathBreadcrumb.php
+
9
−
1
Options
@@ -8,6 +8,7 @@ use Drupal\Core\Link;
use
Drupal\Core\Routing\RouteMatchInterface
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Drupal\Core\Url
;
use
Drupal\node\NodeInterface
;
/**
* Pretty Paths breadcrumb builder.
@@ -40,7 +41,14 @@ class PrettyPathBreadcrumb implements BreadcrumbBuilderInterface {
$title
=
\Drupal
::
service
(
'title_resolver'
)
->
getTitle
(
$request
,
$route_object
);
$url
=
Url
::
fromUserInput
(
$route_without_facets_query
);
// We check if the current page is a node page.
$node
=
$route_match
->
getParameter
(
'node'
);
if
(
$node
instanceof
NodeInterface
)
{
$url
=
$node
->
toUrl
();
}
else
{
$url
=
Url
::
fromUserInput
(
$route_without_facets_query
);
}
$links
[]
=
Link
::
createFromRoute
(
$this
->
t
(
'Home'
),
'<front>'
);
$links
[]
=
Link
::
fromTextAndUrl
(
$title
,
$url
);
return
$breadcrumb
->
setLinks
(
$links
);
Loading