array( 'label' => t('Display the link as an image tag '), 'field types' => array('link_field'), 'multiple values' => FIELD_BEHAVIOR_DEFAULT, ), ); } function link_image_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) { $elements = array(); foreach ($items as $delta => $item) { $elements[$delta] = array( '#markup' => theme('link_image_formatter_'. $display['type'], array('element' => $item, 'field' => $instance)), ); } return $elements; } //Fonction de theme qui permet la generation d'une liste en ligne ou chaque item est séparer par une virgule function link_image_theme(){ return array( 'link_image_formatter_link_image' => array( 'variables' => array('element'=>NULL) ) ); } function theme_link_image_formatter_link_image($element){ if($element['element']['url']!=''){ return theme( 'image', array( 'path'=>$element['element']['url'], 'alt'=>$element['element']['title'], 'title'=>$element['element']['title'], 'attributes'=>$element['element']['attributes'] ) ); } else return ''; }