- Issue created by @joachim
The docs for the hook, and several implementations in code, put #attributes at the top of their links:
$links['my_module'] = [
'#theme' => 'links__node__my_module',
'#attributes' => ['class' => ['links', 'inline']], <-- here
'#links' => [
'node-report' => [
'title' => t('Report'),
'url' => Url::fromRoute('node_test.report', ['node' => $entity->id()], ['query' => ['token' => \Drupal::getContainer()->get('csrf_token')->get("node/{$entity->id()}/report")]]),
],
],
];
AFAICT this has no effect.
This is because Drupal\Core\Render\Element\Link::preRenderLinks() does this:
$element['#links'] += $child['#links'];
and the rest of the child array is ignored.
Active
11.0 🔥