Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
menu_link_sync
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
menu_link_sync
Commits
a0ba7aa7
Commit
a0ba7aa7
authored
4 months ago
by
Yves Guide
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3475243
Check if node translation exist before loading it
parent
ea1e7298
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
menu_link_sync.module
+6
-2
6 additions, 2 deletions
menu_link_sync.module
with
6 additions
and
2 deletions
menu_link_sync.module
+
6
−
2
View file @
a0ba7aa7
...
...
@@ -107,10 +107,14 @@ function _menu_link_sync_get_source_nid($menu_link_id) {
*/
function
_menu_link_sync_get_link_for_target_language
(
$menu_link_id
,
$target_language
)
{
$nid
=
_menu_link_sync_get_source_nid
(
$menu_link_id
);
if
(
$nid
!==
FALSE
)
{
$node
=
Node
::
load
(
$nid
);
/** @var \Drupal\menu_link\Plugin\Field\FieldType\MenuLinkItem $link */
return
$node
->
getTranslation
(
$target_language
)
->
get
(
'field_menulink'
)[
0
];
if
(
$node
->
hasTranslation
(
$target_language
)
)
{
/** @var \Drupal\menu_link\Plugin\Field\FieldType\MenuLinkItem $link */
return
$node
->
getTranslation
(
$target_language
)
->
get
(
'field_menulink'
)[
0
];
}
}
return
FALSE
;
}
...
...
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