Created
July 20, 2015 14:56
-
-
Save waako/0e7be9d63791d65fe4db to your computer and use it in GitHub Desktop.
add class to the 1st, and every 3rd and 4th element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $max_delta = count($items) - 1; ?> | |
<div class="<?php print $classes; ?>"<?php print $attributes; ?>> | |
<?php if (!$label_hidden): ?> | |
<div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>: </div> | |
<?php endif; ?> | |
<div class="field-items content"<?php print $content_attributes; ?>> | |
<?php foreach ($items as $delta => $item): ?> | |
<?php | |
$classes = 'grid-3 '; | |
$tmp = $delta % 4; | |
// Applies to the first item, then every 4th item | |
if ($tmp == 0) { | |
$classes .= ' alpha'; | |
} | |
// Apples to every 3rd item | |
elseif ($tmp == 3) { | |
$classes .= ' omega'; | |
} | |
?> | |
<div class=" <?php print $classes; ?>"<?php print $item_attributes[$delta]; ?>><?php print render($item); ?></div> | |
<?php endforeach; ?> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment