I'm using drupal 7, and in my node views, I have a field named field_phone to display phone numbers. It is possible for a company to have more than a phone number, so I add some more rows in form edit to add more phone numbers. Instead of displaying all numbers in multiple rows, Drupal automatically puts them all inline inside a <span> tag. There are so many people on google trying to the opposite thing: make them display inline.

So I think that, by default, it displays multiple values in separated lines. How can I get over this stuff?

P.S.: I know I can edit the template file, and make it display the way I want, but it's not cool at all, when I have to edit all the field template files, as all my multiple-values-fields are displaying that way.

  • 1
    The default is definitely to output item values in separate divs, so it sounds like either your theme or some module is applying an override. You'll want to find that before trying any alternative solutions as it's possible it'll defeat them. Commented Apr 30, 2013 at 13:27

3 Answers 3


1) If you are using a view with field you can click on your field and have a look at


the checkbox "Display all values in the same row" is checked by default. If you uncheck it it's going to show your field in different rows.

2) If you are using a view with content (teaser, full etc..) you can modify the output in different way:

Have a look at Field API The one you may need is template_preprocess_field()

function templatename_preprocess_field(&$variables) {
    if($variables['element']['#field_name'] == 'field_name') {
        if($variables['items']['0']['#markup'] == 'your_value') {
            $variables['items']['0']['#markup'] = '';

If you have Devel Module you can use the dsm() function to see how to manupulate it.

function templatename_preprocess_field(&$variables) {
        if($variables['element']['#field_name'] == 'field_name') {

It will show what's inside $variables['element'] as a drupal message.

3) You can use field.tpl.php and use field-name-[field_name].tpl.php to target only your field. Have a look at theme_field() .

If you want to change all your multiple value field in that way, use the second method without the if statement that targets your field.

Find out the method better fits your needs.


You could be interested in Text Formatter module which enables you to format multi-value fields to your liking

  • I tried but it's doesnt work. choose list format but still output inline :)
    – Hung Ly
    Commented Jul 18, 2012 at 9:31
  • So maybe you could make use of this simple formatter (drupal.stackexchange.com/questions/34848/…) I made available for multivalue fields. You should be able to code it to your needs easily. Commented Jul 18, 2012 at 9:41
  • I don't know that module, but maybe it doesn't work because you have a template file (field.tpl.php or another) that overrides the output. I can see 2 options to achieve your goal - use CSS display: block for your field items (not the best option) or create / use a custom template file that will be used by all the fields on your site (field.tpl.php)
    – rreiss
    Commented Sep 9, 2013 at 5:33

You can create a Custom Field with Views PHP module. You exclude your original value from display, add get the value in your php code with $data or with $row

You can create your own php function to display values as you wish.

Example :

print _your_own_function( $data );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.