How to adapt this code in php for Drupal 7?


{% for item in items %}
<div class="col-sm-{{ 12 // loop.length }}">{{ item.content }}</div>
{% endfor %}

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); ?>
<?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.