Theming own field: how do I control the outer markup? I'm working on a custom field and formatter and right now I'm at the theming stage. My formatter should render a list of items as a run-in list of badges, much like the tags here on Drupal answers. Currently I am getting a top-to-bottom list, as the fields get the Drupal's default wrappers:

&lt;div class="field-items"&gt;
  &lt;div class="field-item even"&gt;...&lt;/div&gt;
  &lt;div class="field-item odd"&gt;...&lt;/div&gt;
&lt;/div&gt;


I thought it would be more appropriate if I had a control over the wrappers markup and delivered something like:

&lt;div class="my-field-wrapper"&gt;
  &lt;span&gt;Value 1&lt;/span&gt;&lt;span&gt;Value 2&lt;/span&gt;&lt;span&gt;etc.&lt;/span&gt;
&lt;/div&gt;


I have already managed to control the span markup via a custom tpl, but I'm unsure how I am supposed to theme the field's outer markup to suppress the default wrappers.
Of course I know I could override div styling by setting display: inline-block, but I treat this as my first theming excercise hoping to learn.
The way to correctly theme what you are asking is shown here: theme_field()

In particular: 


  This is the default theme implementation to display the value of a
  field. Theme developers who are comfortable with overriding theme
  functions may do so in order to customize this markup. This function
  can be overridden with varying levels of specificity. For example, for
  a field named 'body' displayed on the 'article' content type, any of
  the following functions will override this default implementation. The
  first of these functions that exists is used:

THEMENAME_field__body__article()
THEMENAME_field__article()
THEMENAME_field__body()
THEMENAME_field()

  
  Theme developers who prefer to customize templates instead of
  overriding functions may copy the "field.tpl.php" from the
  "modules/field/theme" folder of the Drupal installation to somewhere
  within the theme's folder and customize it, just like customizing
  other Drupal templates such as page.tpl.php or node.tpl.php. However,
  it takes longer for the server to process templates than to call a
  function, so for websites with many fields displayed on a page, this
  can result in a noticeable slowdown of the website. For these
  websites, developers are discouraged from placing a field.tpl.php file
  into the theme's folder, but may customize templates for specific
  fields. For example, for a field named 'body' displayed on the
  'article' content type, any of the following templates will override
  this default implementation. The first of these templates that exists
  is used:

field--body--article.tpl.php
field--article.tpl.php
field--body.tpl.php
field.tpl.php

  
  So, if the body field on the article content type needs customization,
  a field--body--article.tpl.php file can be added within the theme's
  folder. Because it's a template, it will result in slightly more time
  needed to display that field, but it will not impact other fields, and
  therefore, is unlikely to cause a noticeable change in website
  performance. A very rough guideline is that if a page is being
  displayed with more than 100 fields and they are all themed with a
  template instead of a function, it can add up to 5% to the time it
  takes to display that page. This is a guideline only and the exact
  performance impact depends on the server configuration and the details
  of the website.


Finding the right naming convention is somewhat a mess, so I suggest you to try the Theme developer module in order to find out all the possible names for your template file.

Here is the naming convention guide. Given your comment my best guess would then be: field--field-chemical-hazards.tpl.php