Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By WarrickF on
Hi All,
I'm looking at a page.html.twig in the danland Drupal 8 theme and see something like this:
<div class="slideshow">
{% for file in files %}
<img src="{{ file.uri }}" width="100%" height="100%" alt="{{ file.name }}"/>
{% endfor %}
</div>
I can't seem to determine where this "files" variable is defined.
This page in the docs: https://www.drupal.org/docs/8/theming/twig/create-custom-twig-templates-... seems to suggest that there's some code that backs a twig file like this but I can't seem to locate it. Can someone point me in the right direction please?
Thanks
Warrick
Comments
Look in danland.theme, for
Look in danland.theme, for the function danland_preprocess_page(). If that function exists, it may be in there.
That's what I was looking for
That's what I was looking for. Thanks!
I just wasn't expecting to find PHP code in a .theme file .... danland.theme is where that function exists for other readers.