-1

How to adapt this code in php for Drupal 7?

https://jimbir.ch/blog/making-multi-column-content-section-drupal-paragraphs-bootstrap

drupal-paragraph-multi-column-field.html.twig
{% for item in items %}
<div class="col-sm-{{ 12 // loop.length }}">{{ item.content }}</div>
{% endfor %}
0

I placed this code in field--[field name].tpl.php

    <?php foreach ($items as $delta => $item) : ?>
       <div class="col-sm-<?php print round(12/count($items)); ?>">
        <?php print render($item); ?>
         </div>
<?php endforeach; ?>

It seems to work !

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.