Let's face it, sometimes Drupal 7's default field markup is less than ideal. While whipping up a quick field template file might seem trivial to some, you can quickly find yourself in a maintenance nightmare managing template code for content types with many fields. The Semantic Fields module solves that problem nicely.

Default Drupal Markup

With Semantic Fields enabled, field wrapper markup, item/striping classes, label suffixes and more are easily customized from the relative comfort of Drupal's administrative interface. What's more, you can create patterns (the module calls them presets) of markup that you can re-use on other fields. The sub-module that comes packaged with this module even provides some useful example presets to get you started.

Semantic Fields Admin Page

Once you have a field markup preset at your disposal you'll need to navigate to the Manage Display area of the field for your content type and choose your preset to see it in action. You can choose different presets for different display modes which can come in handy when you need to adjust your CSS classes for different displays.

Field - Manage Display

Semantic Fields' settings are exportable via ctools and the presets are exportable to Features which is great for future re-use. Additionally, if you have the Token module enabled, tokens can be used to bring some dynamism to your presets.

While technically still a beta release, Semantic Fields is a great way to gain control over your field markup in a simple and reusable way.

If you enjoyed this Article, you may also enjoy...

Carwin Young

Carwin Young is a former front-end developer at Lullabot.

Featured Work

Latest Podcasts

Let's Connect

Want to learn more about working with us or just say hello?

Contact Us