how to add wrapper div for a image via image formatter in drupal 7? I am creating custom formatter for images using hook_field_formatter_settings_form() in drupal 7.. I need to add wrapper div for my custom formatter. Means when I select this formatter then image should be wrapped by div. 
for example . &lt;div class="wrap"&gt;&lt;img src="#" /&gt;&lt;/div&gt;
You need to add one more hook to default add  to field wrapper.

 function hook_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  $settings = $display['settings']; // Key needs to be defined in info array (who knew?)
  $element = array();
  if ($display['type'] == 'default_formatter') {
    foreach ($items as $delta =&gt; $item) {
      $element = array(
        '#prefix' =&gt; '&lt;div class="wrapper"&gt;',
        '#suffix' =&gt; '&lt;/div&gt;',
      );
    }
  }
  return $element;
}