Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
translation_inheritance
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
translation_inheritance
Commits
ca13c5b4
Commit
ca13c5b4
authored
1 year ago
by
Randal Vanheede
Browse files
Options
Downloads
Patches
Plain Diff
Fix layout builder page wasn't working anymore
parent
7773d7d2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TranslationInheritance.php
+7
-5
7 additions, 5 deletions
src/TranslationInheritance.php
with
7 additions
and
5 deletions
src/TranslationInheritance.php
+
7
−
5
View file @
ca13c5b4
...
...
@@ -15,27 +15,27 @@ class TranslationInheritance implements TranslationInheritanceInterface, Trusted
/**
* Shows a message on the layout builder page if the translation is inherited.
*/
public
static
function
alterLayoutBuilder
(
):
void
{
public
static
function
alterLayoutBuilder
(
$element
)
{
$request
=
\Drupal
::
request
();
if
(
!
$entity_type_id
=
$request
->
attributes
->
get
(
'entity_type_id'
))
{
return
;
return
$element
;
}
$entity
=
$request
->
attributes
->
get
(
$entity_type_id
);
if
(
!
$entity
instanceof
ContentEntityInterface
)
{
return
;
return
$element
;
}
// The entity has to have the field for this to be applicable.
if
(
!
$entity
->
hasField
(
static
::
FIELD_NAME
))
{
return
;
return
$element
;
}
// If this is the default translation, or this translation simply doesn't
// inherit from any other language, we instantly return.
if
(
!
$entity
->
get
(
TranslationInheritanceInterface
::
FIELD_NAME
)
->
source_language
)
{
return
;
return
$element
;
}
// Translation inheritance can be recursive, make sure to get the actual
...
...
@@ -51,6 +51,8 @@ To edit that content, please <a href=":link">click here</a>.', [
'@source'
=>
$language
->
getId
(),
':link'
=>
$url
->
toString
(),
]));
return
$element
;
}
/**
...
...
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