Skip to content
Snippets Groups Projects
Commit dc4fe3cb authored by Tim Diels's avatar Tim Diels
Browse files

Issue #3399604: Fix multilingual problem after #3399077

parent 1eedebfc
No related branches found
No related tags found
No related merge requests found
......@@ -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']++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment