I'd like to know the node title within the file link template. How can I get it?
For the current example I use the bootstrap file-link.html.twig
template. In it, I have the following variables:
{#
/**
* @file
* Theme override for a link to a file.
*
* Available variables:
* - attributes: The HTML attributes for the containing element.
* - link: A link to the file.
* - icon: An icon.
* - icon_only: Flag to display only the icon and not the label.
* - icon_position: Where an icon should be displayed.
*
* @see \Drupal\bootstrap\Plugin\Preprocess\FileLink::preprocessVariables
*/
#}
I dont know if a preprocess function is the correct way to go. I didnt even found a respective hook for drupal 8 for that. I dont even know if this is a field template. But still, the question would also be interesting for other templates than file-link.