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

Jaypan’s picture

Look in danland.theme, for the function danland_preprocess_page(). If that function exists, it may be in there.

WarrickF’s picture

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.