Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
views_block_override
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
views_block_override
Commits
dc4fe3cb
Commit
dc4fe3cb
authored
1 year ago
by
Tim Diels
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3399604
: Fix multilingual problem after
#3399077
parent
1eedebfc
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
views_block_override.install
+28
-22
28 additions, 22 deletions
views_block_override.install
with
28 additions
and
22 deletions
views_block_override.install
+
28
−
22
View file @
dc4fe3cb
...
...
@@ -60,34 +60,40 @@ function views_block_override_update_9101(&$sandbox) {
continue
;
}
$update
=
FALSE
;
// This will get all the sections of the node.
$layout
=
$node
->
get
(
'layout_builder__layout'
)
->
getValue
();
foreach
(
$layout
as
$item
)
{
/** @var \Drupal\layout_builder\Section $section */
$section
=
$item
[
'section'
];
// This will get all the components per section.
foreach
(
$section
->
getComponents
()
as
$component
)
{
$configuration
=
$component
->
get
(
'configuration'
);
if
(
!
empty
(
$configuration
[
'provider'
])
&&
$configuration
[
'provider'
]
===
'views'
&&
!
empty
(
$configuration
[
'exposed_sort'
]))
{
$exposed_sort
=
$configuration
[
'exposed_sort'
];
foreach
(
$exposed_sort
as
$id
=>
$setting
)
{
if
(
is_array
(
$setting
))
{
$configuration
[
'exposed_sort'
][
$id
]
=
$setting
[
'value'
];
$update
=
TRUE
;
// Load all translations.
$translation_languages
=
$node
->
getTranslationLanguages
();
foreach
(
$translation_languages
as
$langcode
=>
$language
)
{
$update
=
FALSE
;
$translation
=
$node
->
getTranslation
(
$langcode
);
// This will get all the sections of the node.
$layout
=
$translation
->
get
(
'layout_builder__layout'
)
->
getValue
();
foreach
(
$layout
as
$item
)
{
/** @var \Drupal\layout_builder\Section $section */
$section
=
$item
[
'section'
];
// This will get all the components per section.
foreach
(
$section
->
getComponents
()
as
$component
)
{
$configuration
=
$component
->
get
(
'configuration'
);
if
(
!
empty
(
$configuration
[
'provider'
])
&&
$configuration
[
'provider'
]
===
'views'
&&
!
empty
(
$configuration
[
'exposed_sort'
]))
{
$exposed_sort
=
$configuration
[
'exposed_sort'
];
foreach
(
$exposed_sort
as
$id
=>
$setting
)
{
if
(
is_array
(
$setting
))
{
$configuration
[
'exposed_sort'
][
$id
]
=
$setting
[
'value'
];
$update
=
TRUE
;
}
}
}
if
(
$update
)
{
$component
->
setConfiguration
(
$configuration
);
if
(
$update
)
{
$component
->
setConfiguration
(
$configuration
);
}
}
}
}
}
if
(
$update
)
{
$node
->
save
();
if
(
$update
)
{
$translation
->
save
();
}
}
$sandbox
[
'current'
]
++
;
...
...
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