F
F
foxijke2017-12-19 00:44:54
Drupal
foxijke, 2017-12-19 00:44:54

Drupal 8, material theming, how to do it right?

Can someone tell me how to display the material correctly, there is a picture field, so I just need to display it,
what will be according to the layout

<div class='block'>
  <img class='block__img' src='....'>
</div>
<div class='block'>
  <img class='block__img' src='....'>
</div>

how to do it so that there is no crazy nesting of tags like Drupal does?
that's what drupal gives me, I understand that logically this is correct, but it's impossible to do something like yours wrote?
<div class="views-element-container" id="block-views-block-bannernye-bloki-block-1">
  <div>
    <div class="js-view-dom-id-0ca3329e3de4f021b595ac442ecc1d52d0130ada223659ca167da404ea92905b">
      <div class="b-right-banner views-row">
        <div class="views-field views-field-field-kartinka-1">
          <div class="field-content">
            <img src="/sites/default/files/2017-12/right-banner_2.png" width="292" height="261" alt="" typeof="foaf:Image">
          </div>
        </div>
      </div>
      <div class="b-right-banner views-row">
        <div class="views-field views-field-field-kartinka-1">
          <div class="field-content">
            <img src="/sites/default/files/2017-12/right-banner_1.png" width="292" height="261" alt="" typeof="foaf:Image">
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
afi13, 2017-12-19
@afi13

The HTML in your example is the output of several Views templates.
I recommend enabling Twig debug and Drupal will tell you in HTML comments what templates you need to create or fix:
https://www.drupal.org/docs/8/theming/twig/debuggi...
https://sqndr.github. io/d8-theming-guide/twig/twig...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question