Format field labels

Using the CERN theme, is there any way to format the field labels? See attached screenshots - one from the D7 site with the [h2] labels, and the other from the D8 site where there is no formatting.

In D7 there was a module called Field Label Format which did the job very nicely.

However in D8, no such module exists, and it’s not clear to me how to approach this in the CERN theme. See screenshot where it all looks very plain…

Is this a CSS/override job? Or is there some magic tool/module you can recommend which automagically does this?

Have you tried that ?

Hello Cath,

I guess this can be changed in the Manage Display of the content type, but I need more information:

  • URL of the view (I guess its a view)
  • The content type that you are currently working



Hi both,

I found the solution eventually… it’s done through Display Suite. It seems you could do some codey thing with hook_form_alter, but as a non-developer I was looking for something that didn’t involve that :slight_smile:

Unfortunately the module “Field Formatter” only seems to deal with the field itself, not its label. I spent a long time looking at modules, and my conclusion is are no D8 modules which seem to do this specifically (whereas in D7 there is). I couldn’t believe that the concept of formatting the node field labels seemed to no longer exist in D8 without having to code, but after a lot of research and litres of coffee, I found that Display Suite does the job. Seems like a sledgehammer to crack a nut to me, but hey ho, it works… [shrug]

This is what you have to do:

  • Go to Structure > Display Suite > Settings (in the sub-navigation menu line)
  • Tick ‘Enable Field Templates’
  • Under Default Field Template, select “Expert”
  • Save configuration.
  • Go to “Manage Display” tab of your content type or node.
  • Click on the cog for any of the field items you want to format
  • If “Expert” field template is selected (as it should be by default, but if not then select it) then you’ll see a list of the things you can format. I put [h2] for my label.
  • Hit update (for the field) + save

… I found it still didn’t work, but then found that if you select Display Suite to render the node, it works. To do this:

… and that works…

Do I win a prize? :wink:

1 Like

Nice work Cath!