public static function preRenderLinks(array
$element) { // Retrieve contextual menu links.
$items =
[];
$contextual_links_manager =
static::
contextualLinkManager();
foreach ($element['#contextual_links'
] as $group =>
$args) { $args +=
[ 'route_parameters' =>
[],
'metadata' =>
[],
];
$items +=
$contextual_links_manager->
getContextualLinksArrayByGroup($group,
$args['route_parameters'
],
$args['metadata'
]);
} uasort($items,
[SortArray::
class, 'sortByWeightElement'
]);