Im not sure the best way to go about this, and not so much a big programmer...

I would like to let the node creator decide whether the image in the image field should be top, left, or right. So i simply want to add class to the image div somehow.

So there should be a way to grab that info, maybe a "list" field?

Now, how to get that info over the image field?

Im thinking something like a field template for the image field (using media module)... or maybe something i heard about preprocessing in template.php?

pointer and tips appreciated!

1 Answer 1


You are looking for Image Class module - either use it directly, or use it's code - it is open source after all.

Extends the Image formatter by adding an option to add an element class.

  • Thanks, that looks nice. However I'm using the media module, and also want something easy for the end user (radio select from preset)
    – petergus
    Commented Dec 11, 2013 at 11:07
  • @petergus well, Drupal is as much a framework as it is a CMS. As I have already said, "use it's code - it is open source after all" so you can tailor it to your specific needs.
    – Mołot
    Commented Dec 11, 2013 at 11:08
  • :) ya, im not to much a programmer, but i had a look. I dont really want to use view modes, i just want to say 'hey, write the value of this field as a class to that field'. I will ask a new question to be more specific then. THanks!
    – petergus
    Commented Dec 11, 2013 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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