laryn's picture

Q&A transcribed from Gitter:

I have a whole different set of questions after the converting D7 theme session last week? I'm on to working with template files for the first time. How do I locate which template file is driving the bus to know which one to copy and modify? (@keiserjb)

Accepted answer

Enable devel module, go to admin/config/development/devel, Enable theme debug and then inspecting HTML elements through your browsers developer console will show all the theme templates: existing or suggested ones. (@alanmels)

Comments

Enable devel module, go to admin/config/development/devel, Enable theme debug and then inspecting HTML elements through your browsers developer console will show all the theme templates: existing or suggested ones. (@alanmels)

Olafski's picture

If you don't use Devel, there is also a Theme debug value in files/config_SOME-CRYPTIC-STRING/active/system.core.json which by default is set to 0.

"theme_debug": 0,

As a follow up to this question, I'm trying to theme a paragraph bundle.  The top 3 bootstrap cards are coded in the body field.  The bottom 3 are from a paragraph bundle and I'm trying to get them to look the same.

So I'm trying to get this part of the template 

<div class="field-item text-center <?php print $delta % 2 ? 'odd' : 'even'; ?>"<?php print backdrop_attributes($item_attributes[$delta]); ?>><?php print render($item); ?></div>

to put the class card-img-top inside the image tag so it looks like this  

<img class="card-img-top" src="http://jpl-local.lndo.site/files/styles/medium/public/Get%20a%20Library%..." alt="Image of a man using a mobile device to check out materials from the Jacksonville Public Library" width="220" height="169">

My php knowledge is minimal at the moment but I gather the print render($item) is spitting out the contents of the field so is it possible to inject the class?