0

I use unlimited values for image field in a content type, then the images displays one below the other :

enter image description here

Is there a way to render this field differently? For example every line show me only three images.

Im using display_suite module to display the node content.

  • Yep, that would would be CSS... – Clive May 19 '14 at 16:42
  • Yes, that must be with css ;) but how can I wrap every three items of that field with a div. Because if I don't group items togother, and float left every single item, it will be a mess in the page :) – Boussetta moez May 19 '14 at 16:48
  • They would traditionally be wrapped in <div>s with field-... classes, if not maybe your theme defines a field.tpl.php which overrides that? Either way, the Fences module would probably help out. On each field settings page you can define the tags that should wrap each item – Clive May 19 '14 at 16:53
1

CSS. Your fieldset should be wrapped in one big div, with each field-item wrapped in it's own div. I see no reason you couldn't do this with CSS alone.

Unless there's a specific reason you need each line to be exactly three images. In that case you would have to override the field template: https://drupal.org/node/1089656

Then you would have to write some basic PHP logic that counts the number of field items and print those out in a 1X3 display.

| improve this answer | |
  • This what I need exactly, it's a custom template for my field (I know that it can be done with css but it's not enough for my case...) thanks! – Boussetta moez May 20 '14 at 8:26
0

You can do this by adding CSS for the row

.class-of-the-row { display: inline-block; width: 33.3333%; }

| 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.