What is the proper way to control how images display on a form that is generated by a module? Continuing to work on the Book data module ISBN2node, I have successfully updated the code to pull titles based on a keyword query and show it in a form for the user to select one.

This is what it looks like right now:

It would be nice to have the image float at the left and have the text display in 3 lines to the right. I can do the text easily, but how to do the image? Current code:

$options[$title['isbn']] = ($img ? theme('image', array('path' => $img)) : '')      
  . ' <em>' . $title['title'] . '</em>'
  . ' - ' . $title['author'] 
  . ' - ISBN: ' . $title['isbn'] . ' / ' . $title['isbn13'];

I tried adding style attributes to the theme(...) call, but that doesn't work.

Thanks!

Accepted answer

Have you tried simply adding a css file to your custom module and adding it through the .info file?

Comments

Have you tried simply adding a css file to your custom module and adding it through the .info file?

No, I haven't. If I do this, would the .css then only affect forms (etc) provided by this module? It's unclear to me from the documentation page. My concern is that the HTML generated doesn't include any classes that I could use to control the styling for just these elements.

I will try it though. Thanks for the suggestion!

By adding a <p> wrapper with a class, I was able to get it adequately styled. I put the css in the mymodule.theme.css file so it can be overridden in the theme if desired.

Thanks again for your help.