Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
easy_breadcrumb
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
easy_breadcrumb
Commits
2f280556
Commit
2f280556
authored
3 years ago
by
Samuel Oltz
Browse files
Options
Downloads
Patches
Plain Diff
only allow TitleResolver to check for alternative field on fieldable entities. Fixes
#3253835
parent
d929a158
No related branches found
No related tags found
1 merge request
!32
Issue #3253835: TitleResolver checks for alternative field on non-fieldable entities
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TitleResolver.php
+2
-1
2 additions, 1 deletion
src/TitleResolver.php
with
2 additions
and
1 deletion
src/TitleResolver.php
+
2
−
1
View file @
2f280556
...
@@ -7,6 +7,7 @@ use Drupal\Core\Url;
...
@@ -7,6 +7,7 @@ use Drupal\Core\Url;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\Routing\Route
;
use
Symfony\Component\Routing\Route
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\Core\Entity\FieldableEntityInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Core\Config\ConfigFactoryInterface
;
use
Drupal\Component\Utility\Xss
;
use
Drupal\Component\Utility\Xss
;
...
@@ -61,7 +62,7 @@ class TitleResolver extends ControllerTitleResolver {
...
@@ -61,7 +62,7 @@ class TitleResolver extends ControllerTitleResolver {
}
}
if
(
$entity
!==
NULL
)
{
if
(
$entity
!==
NULL
)
{
$alternative_title_field
=
$this
->
config
->
get
(
EasyBreadcrumbConstants
::
ALTERNATIVE_TITLE_FIELD
);
$alternative_title_field
=
$this
->
config
->
get
(
EasyBreadcrumbConstants
::
ALTERNATIVE_TITLE_FIELD
);
if
(
$entity
->
hasField
(
$alternative_title_field
)
&&
!
$entity
->
get
(
$alternative_title_field
)
if
(
$entity
instanceof
FieldableEntityInterface
&&
$entity
->
hasField
(
$alternative_title_field
)
&&
!
$entity
->
get
(
$alternative_title_field
)
->
isEmpty
())
{
->
isEmpty
())
{
return
Xss
::
filter
(
$entity
->
get
(
$alternative_title_field
)
->
value
);
return
Xss
::
filter
(
$entity
->
get
(
$alternative_title_field
)
->
value
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment