- π¦πΊAustralia 2pha
Thanks for the workaround @jlbellido
Needed it on a site I am not able to make custom modules (a field formatter) for.
I've noticed that the documentation on template_preprocess_file_link()
includes:
array $variables: An associative array containing:
(...)
attributes: An associative array of attributes to be placed in the a tag.
(See: https://api.drupal.org/api/drupal/core%21modules%21file%21file.module/fu...)
However, the function actually initializes $options
as an empty array, then sets some $options['attributes']
and passes that into the functions that generate the link markup.
If passed, the attributes in $variables['attributes']
are actually intended for the <span>
that contains the file link - as seen in the default template, file-link.html.twig.
See: https://api.drupal.org/api/drupal/core%21modules%21file%21templates%21fi...
I'm guessing this was probably small documentation mistake, rather than a bug. I marked this as a feature request though, as it would be helpful to allow preprocess functions for this theme hook to provide attributes for the link element itself.
Active
11.0 π₯
theme system
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Thanks for the workaround @jlbellido
Needed it on a site I am not able to make custom modules (a field formatter) for.