i'm using the forms api to modify some content edit forms. i have a custom field that is presented as radio buttons. i want them to display horizontally on one row, rather than vertically. is there an easy way to do that, or do i just need to hack it in with css in the form alter function?
thanks for any thoughts.
This sounds like something I would address with CSS in the theme.
If you are using the the forms API, I guess you are trying to do this in a custom module and looking for a way to do it in code?
I think you can accomplish what you're trying to do with the "container-inline" class, such as this:
This results in output such as:
Though it may be better to add your own unique CSS class instead and also attach a library or CSS file with the #attached property to style it. It depends if you feel you need further control beyond just getting them inline, because that will only set display: inline and nothing further.
thanks for the input, stpaultim and quicksketch. i did end up just adding some css via the forms api. i basically added #prefix and #suffix elements where i wrapped them in divs with display:inline. it took a little to figure out the right elements to target for best control, but i got it.
i will clean it up at some point and add my own classes via jquery, most likely. i've used the forms api over the yeas in drupal, but i never got fully comfortable with the complexity and repetitiveness of the render arrays. just at first glance, it looks to me like maybe backdrop has trimmed those arrays down a bit.