my_theme.theme
/**
* Implements hook_preprocess_HOOK() for layout.html.twig.
*/
function hook_preprocess_layout(&$variables) {
$layout = $variables['layout'];
foreach ($layout->getRegionNames() as $region_name) {
if (array_key_exists($region_name, $variables['content'])) {
uasort($variables['content'][$region_name], [\Drupal\Component\Utility\SortArray::class, 'sortByWeightProperty']);
}
}
}
12.12.2025 | Pascal Crott