Skip to content
Snippets Groups Projects
Commit 72df0418 authored by Cristina Chumillas's avatar Cristina Chumillas
Browse files

Issue #3390478: Change weight

parent 457eb6d1
Branches
Tags
1 merge request!96Issue #3390478: Change weight
<?php
use Drupal\Component\Utility\SortArray;
use Drupal\Core\Url;
/**
......@@ -16,7 +17,9 @@ function navigation_preprocess_html(array &$variables) {
$menu[$definition['region']][$id] = $instance->getMenuItems();
$menu[$definition['region']][$id]['#weight'] = $definition['weight'];
}
foreach ($menu as $region => $region_data) {
uasort($region_data, [SortArray::class, 'sortByWeightElement']);
}
$variables['page_top']['navigation'] = [
'#theme' => 'navigation',
'#menu_middle' => $menu['middle'],
......
......@@ -13,6 +13,7 @@ use Drupal\navigation\NavigationSectionInterface;
* id = "admin",
* title = "Administration",
* region = "middle",
* weight = 5,
* )
*/
class NavigationAdmin extends PluginBase implements NavigationSectionInterface {
......
......@@ -31,9 +31,7 @@
</div>
{{ menu_top }}
{% for section in menu_middle %}
{{ section }}
{% endfor %}
{{ menu_middle }}
</nav>
{# @todo - This sticky menu should exist under the <nav> landmark element above. #}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment